Metanet Programmer Directory

Talk about computers, hardware, applications, and consumer electronics.
Yes sir, no sir, three bags full sir
Posts: 1561
Joined: 2008.09.26 (12:33)
NUMA Profile: http://nmaps.net/user/incluye
MBTI Type: ENTP
Location: USofA
Contact:

Postby otters » 2010.11.06 (02:14)

Geti wrote:
incluye wrote:Why does === exist?
So you can check for identical types as well as values? O_o
Why doesn't == do that? O_o
Image

User avatar
Lifer
Posts: 1099
Joined: 2008.09.26 (21:35)
NUMA Profile: http://nmaps.net/user/smartalco
MBTI Type: INTJ

Postby smartalco » 2010.11.06 (02:58)

Because more often you would want to know something like if the string '0' is equal to the value zero.
Image
Tycho: "I don't know why people ever, ever try to stop nerds from doing things. It's really the most incredible waste of time."
Adam Savage: "I reject your reality and substitute my own!"

User avatar
Depressing
Posts: 1977
Joined: 2008.09.26 (06:46)
NUMA Profile: http://nmaps.net/user/rennaT
MBTI Type: ISTJ
Location: Trenton, Ontario, Canada
Contact:

Postby Tanner » 2010.11.06 (12:01)

smartalco wrote:Because more often you would want to know something like if the string '0' is equal to the value zero.
Wait. So comparing a string of "0" and an int of "0" would return that they're the same? I'm thoroughly opposed to this idea.
Image
'rret donc d'niaser 'vec mon sirop d'erable, calis, si j't'r'vois icitte j'pellerais la police, tu l'veras l'criss de poutine de cul t'auras en prison, tabarnak

Yes sir, no sir, three bags full sir
Posts: 1561
Joined: 2008.09.26 (12:33)
NUMA Profile: http://nmaps.net/user/incluye
MBTI Type: ENTP
Location: USofA
Contact:

Postby otters » 2010.11.06 (12:31)

hairscapades wrote:
smartalco wrote:Because more often you would want to know something like if the string '0' is equal to the value zero.
Wait. So comparing a string of "0" and an int of "0" would return that they're the same? I'm thoroughly opposed to this idea.
Exactly. If you want to figure out of the integer value of "0" is 0, then cast it as a gosh-darned integer or something. This is part of my "babysitting the programmer" idea. Another is:

Code: Select all

<?php # prints out nothing
if("0") print "hello";
if(0) print "hello";
if("") print "hello";
if(0.0) print "hello";
Image

Raigan and the Horse-Woman
Raigan and the Horse-Woman
Posts: 182
Joined: 2008.09.27 (02:14)
NUMA Profile: www.nmaps.net/user/sidke
Steam: www.steamcommunity.com/id/shagdish
Location: ⑨ 
Contact:

Postby sidke » 2010.11.06 (17:55)

incluye wrote:
hairscapades wrote: Wait. So comparing a string of "0" and an int of "0" would return that they're the same? I'm thoroughly opposed to this idea.
Exactly. If you want to figure out of the integer value of "0" is 0, then cast it as a gosh-darned integer or something. This is part of my "babysitting the programmer" idea. Another is:

Code: Select all

<?php # prints out nothing
if("0") print "hello";
if(0) print "hello";
if("") print "hello";
if(0.0) print "hello";
php doesn't have type definition... so instead of complaining, you should thank php for being flexible like this, learn its quirks, and get over them.
because if you can't, you use a different language. simple.
spoiler

辻菜摘が好きじゃー ヽ(´ー`)ノ sig by peking duck


User avatar
Retrofuturist
Posts: 3131
Joined: 2008.09.19 (06:55)
MBTI Type: ENTP
Location: California, USA
Contact:

Postby t̷s͢uk̕a͡t͜ư » 2010.11.06 (20:16)

nevada wrote:php doesn't have type definition... so instead of complaining, you should thank php for being flexible like this, learn its quirks, and get over them.
because if you can't, you use a different language. simple.
The point is that this is bad programming practice, and PHP, by encouraging this kind of bullshit, will build bad programming habits.
But I guess this really isn't that serious of a problem if you're planning on never using any other language, collaborating with others, or working on a large project.

As for the distinction between equality and identity, that's actually a valid issue. If that's the difference between the == and the === operator in PHP, I have nothing against that. In Python, that difference is the == operator versus the is operator. In C, it's the difference between comparing values and comparing memory addresses. In Lisp, it's the difference between equal and eq. It's definitely an important distinction.
[spoiler="you know i always joked that it would be scary as hell to run into DMX in a dark ally, but secretly when i say 'DMX' i really mean 'Tsukatu'." -kai]"... and when i say 'scary as hell' i really mean 'tight pink shirt'." -kai[/spoiler][/i]
spoiler

Image


Raigan and the Horse-Woman
Raigan and the Horse-Woman
Posts: 182
Joined: 2008.09.27 (02:14)
NUMA Profile: www.nmaps.net/user/sidke
Steam: www.steamcommunity.com/id/shagdish
Location: ⑨ 
Contact:

Postby sidke » 2010.11.06 (23:35)

T̷s͢uk̕a͡t͜ư wrote:The point is that this is bad programming practice, and PHP, by encouraging this kind of bullshit, will build bad programming habits.
But I guess this really isn't that serious of a problem if you're planning on never using any other language, collaborating with others, or working on a large project.
because there've never been large-scale web development projects done in php using - holy shit, get this - a repository that lets teams of developers work on the same project aka collaborating. i think you're funny.

it was inevitable that a programming thread would end up a language bashing thread.
spoiler

辻菜摘が好きじゃー ヽ(´ー`)ノ sig by peking duck


User avatar
Average Time to Take Breakfast in Equador
Posts: 640
Joined: 2008.09.27 (03:11)
NUMA Profile: http://nmaps.net/user/geti
MBTI Type: ENFJ
Contact:

Postby Geti » 2010.11.07 (01:16)

I'm just surprised we haven't got back onto editor wars yet.

@Tsukatu are you opposed to dynamically typed variables or just PHP's implementation? I've always found them both a blessing and a curse, but if you're smart about how you're coding something there's no issue with them. Unless I'm missing your point entirely O_o
spoiler

"I'd be happy for a lion if it hunted me down and ate me, but not so happy for it if it locked up me and my family, then forced us to breed so it may devour our offspring." - entwilight <3
How do you know that God didn't intend for humans to be the animals' caretakers? He might be appalled that He gave us these animals to use and we're fucking eating them. - Tsukatu
4th - DDA Speedrunning Contest.
One Hundred Percent Vegetarian

deviantArt Profile - 1BarDesign
God knows if i'm back.

Yes sir, no sir, three bags full sir
Posts: 1561
Joined: 2008.09.26 (12:33)
NUMA Profile: http://nmaps.net/user/incluye
MBTI Type: ENTP
Location: USofA
Contact:

Postby otters » 2010.11.07 (02:00)

Geti wrote:I'm just surprised we haven't got back onto editor wars yet.
TEXTMATE \m/
Image

User avatar
Global Mod
Global Mod
Posts: 1416
Joined: 2008.09.26 (05:35)
NUMA Profile: http://nmaps.net/user/scythe33
MBTI Type: ENTP
Location: 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0

Postby scythe » 2010.11.07 (02:22)

C and Lua. Not C++, though it's a decent language that is simply misunderstood.
As soon as we wish to be happier, we are no longer happy.

User avatar
Lifer
Posts: 1099
Joined: 2008.09.26 (21:35)
NUMA Profile: http://nmaps.net/user/smartalco
MBTI Type: INTJ

Postby smartalco » 2010.11.07 (02:29)

Dynamically typed variables are the shit, as the kids say.
Image
Tycho: "I don't know why people ever, ever try to stop nerds from doing things. It's really the most incredible waste of time."
Adam Savage: "I reject your reality and substitute my own!"

User avatar
Global Mod
Global Mod
Posts: 1416
Joined: 2008.09.26 (05:35)
NUMA Profile: http://nmaps.net/user/scythe33
MBTI Type: ENTP
Location: 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0

Postby scythe » 2010.11.07 (02:33)

smartalco wrote:Dynamically typed variables are the shit, as the kids say.
And they can be fast, too.
As soon as we wish to be happier, we are no longer happy.

User avatar
Retrofuturist
Posts: 3131
Joined: 2008.09.19 (06:55)
MBTI Type: ENTP
Location: California, USA
Contact:

Postby t̷s͢uk̕a͡t͜ư » 2010.11.07 (06:31)

Geti wrote:@Tsukatu are you opposed to dynamically typed variables or just PHP's implementation? I've always found them both a blessing and a curse, but if you're smart about how you're coding something there's no issue with them. Unless I'm missing your point entirely O_o
I'm talking about the entirety of PHP's style.
scythe wrote:Not C++, though it's a decent language that is simply misunderstood.
http://harmful.cat-v.org/software/c++/coders-at-work
[spoiler="you know i always joked that it would be scary as hell to run into DMX in a dark ally, but secretly when i say 'DMX' i really mean 'Tsukatu'." -kai]"... and when i say 'scary as hell' i really mean 'tight pink shirt'." -kai[/spoiler][/i]
spoiler

Image


User avatar
Average Time to Take Breakfast in Equador
Posts: 640
Joined: 2008.09.27 (03:11)
NUMA Profile: http://nmaps.net/user/geti
MBTI Type: ENFJ
Contact:

Postby Geti » 2010.11.07 (07:10)

Ah, fair enough. To each his xor her own though. Interesting read in the article. Everyone there's thoughts on complexity seem to be mimicking mine, so that's a good sign.

@scythe: wait, justintime compilation has nothing to do with dynamic typing though, it's just cramming everying into bytecode at runtime so you aren't iterating through code, you're iterating through what it means to the machine. Sure, faster, and yes, marvellous idea, but not really to do with dynamic type.
Actually, most interpreted languages (the ones that benefit from all that JIT goodness) nowadays are dynamically typed, so maybe that's what you were getting at?
incluye wrote:TEXTMATE \m/
Pff I think you mean geany for graphical editors (though, if anyone has another suggestion for lightweight *nix IDEs I'm open, geany does its job pretty damn well though). I'm undecided as far as cli editors go.
spoiler

"I'd be happy for a lion if it hunted me down and ate me, but not so happy for it if it locked up me and my family, then forced us to breed so it may devour our offspring." - entwilight <3
How do you know that God didn't intend for humans to be the animals' caretakers? He might be appalled that He gave us these animals to use and we're fucking eating them. - Tsukatu
4th - DDA Speedrunning Contest.
One Hundred Percent Vegetarian

deviantArt Profile - 1BarDesign
God knows if i'm back.

User avatar
Retrofuturist
Posts: 3131
Joined: 2008.09.19 (06:55)
MBTI Type: ENTP
Location: California, USA
Contact:

Postby t̷s͢uk̕a͡t͜ư » 2010.11.07 (09:43)

Anyone else tried out Google's Go?

I am unenthusiastic after my first foray:

Image
[spoiler="you know i always joked that it would be scary as hell to run into DMX in a dark ally, but secretly when i say 'DMX' i really mean 'Tsukatu'." -kai]"... and when i say 'scary as hell' i really mean 'tight pink shirt'." -kai[/spoiler][/i]
spoiler

Image


User avatar
Global Mod
Global Mod
Posts: 1416
Joined: 2008.09.26 (05:35)
NUMA Profile: http://nmaps.net/user/scythe33
MBTI Type: ENTP
Location: 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0

Postby scythe » 2010.11.07 (09:51)

T̷s͢uk̕a͡t͜ư wrote:Anyone else tried out Google's Go?

I am unenthusiastic after my first foray:

Image
Took a look, wasn't interested. I was hoping it would be like OCaml, only without that horrible abortion of a syntax that OCaml uses (OCaml makes Perl look elegant). Instead it turned out to be compiled Java, only not a total piece of shit, but twice as slow.
As soon as we wish to be happier, we are no longer happy.

User avatar
Retrofuturist
Posts: 3131
Joined: 2008.09.19 (06:55)
MBTI Type: ENTP
Location: California, USA
Contact:

Postby t̷s͢uk̕a͡t͜ư » 2010.11.07 (09:56)

scythe wrote:[Go] turned out to be compiled Java, only not a total piece of shit, but twice as slow.
You forgot "and 2,500 times the size" (javac'd Hello World was ~400 bytes).
[spoiler="you know i always joked that it would be scary as hell to run into DMX in a dark ally, but secretly when i say 'DMX' i really mean 'Tsukatu'." -kai]"... and when i say 'scary as hell' i really mean 'tight pink shirt'." -kai[/spoiler][/i]
spoiler

Image


User avatar
Qui si castrano ragazzi
Posts: 297
Joined: 2008.09.19 (15:24)
NUMA Profile: http://nmaps.net/user/gamingwolf2000
MBTI Type: INTP
Location: Interdimensional Nexus
Contact:

Postby GamingWolf » 2010.11.07 (15:59)

Oh hey there was other articles on that site that I probably needed to read. Thank you for that.
Image

User avatar
Retrofuturist
Posts: 3131
Joined: 2008.09.19 (06:55)
MBTI Type: ENTP
Location: California, USA
Contact:

Postby t̷s͢uk̕a͡t͜ư » 2010.11.08 (03:35)

GamingWolf wrote:
Oh hey there was other articles on that site that I probably needed to read. Thank you for that.
Yeah, I've been using the information on that site to look into stuff I should know but have little means of finding out about in the first place.
I'm still slightly skeptical of some of its criticisms, but I'm always interested in gaining perspective, so that list of better practices is something of a "to learn" list for me right now.
[spoiler="you know i always joked that it would be scary as hell to run into DMX in a dark ally, but secretly when i say 'DMX' i really mean 'Tsukatu'." -kai]"... and when i say 'scary as hell' i really mean 'tight pink shirt'." -kai[/spoiler][/i]
spoiler

Image


Plus (Size) Member
Posts: 42
Joined: 2008.09.27 (02:56)

Postby taaveti » 2010.11.09 (05:30)

T̷s͢uk̕a͡t͜ư wrote:
GamingWolf wrote:
Oh hey there was other articles on that site that I probably needed to read. Thank you for that.
Yeah, I've been using the information on that site to look into stuff I should know but have little means of finding out about in the first place.
I'm still slightly skeptical of some of its criticisms, but I'm always interested in gaining perspective, so that list of better practices is something of a "to learn" list for me right now.
Yeah, a lot of their criticisms seem to be based on a really narrow world view (e.g. advocating against HTTP or dynamic libraries). There are certainly some valid points made there, but there are a good number of invalid ones too. The fact that they suggest that exchanging tarballs and patches could be better than subversion counts pretty heavily against their credibility (if they had stopped at git I could've called it a matter of opinion or filed it under "narrow world view", but having used CVS, svn, and plain archives I have to say that svn is the clear winner of the three).
That said, the general idea of reducing complexity is definitely one that needs to be stressed. I may not state it as a flat "c++ doubleplusungood", but I would caution someone not to get so absorbed in the OO paradigm that they ignore the obvious and simple answer in pure c.

The maximum possible score in one turn at darts.
Posts: 197
Joined: 2008.09.26 (16:57)
NUMA Profile: http://nmaps.net/user/beginner2
MBTI Type: ISTP

Postby mediate » 2010.11.09 (16:16)

I'm to learn C++ at university. That would be my first programming language. Right now, I'm learning and using Maple, which is crap-on-wheels.

User avatar
Global Mod
Global Mod
Posts: 1416
Joined: 2008.09.26 (05:35)
NUMA Profile: http://nmaps.net/user/scythe33
MBTI Type: ENTP
Location: 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0

Postby scythe » 2010.11.15 (01:44)

T̷s͢uk̕a͡t͜ư wrote:
scythe wrote:Not C++, though it's a decent language that is simply misunderstood.
http://harmful.cat-v.org/software/c++/coders-at-work
Qt, though, is awesome. I can agree that C++ is all-too-often terrible, but in the form of Qt it's great.
As soon as we wish to be happier, we are no longer happy.

User avatar
Retrofuturist
Posts: 3131
Joined: 2008.09.19 (06:55)
MBTI Type: ENTP
Location: California, USA
Contact:

Postby t̷s͢uk̕a͡t͜ư » 2010.11.18 (00:57)

Extremely relevant to previous conversation:
http://www.reddit.com/r/programming/com ... variables/

And if you're particularly interested in this specific problem, some further reading.
[spoiler="you know i always joked that it would be scary as hell to run into DMX in a dark ally, but secretly when i say 'DMX' i really mean 'Tsukatu'." -kai]"... and when i say 'scary as hell' i really mean 'tight pink shirt'." -kai[/spoiler][/i]
spoiler

Image


User avatar
Lifer
Posts: 1099
Joined: 2008.09.26 (21:35)
NUMA Profile: http://nmaps.net/user/smartalco
MBTI Type: INTJ

Postby smartalco » 2010.11.18 (03:26)

T̷s͢uk̕a͡t͜ư wrote:Extremely relevant to previous conversation:
http://www.reddit.com/r/programming/com ... variables/

And if you're particularly interested in this specific problem, some further reading.
That is fucking awesome. And by 'fucking awesome' I mean 'fucking awesome if you want to write some really fucked up obfuscated code, or just play around with a language'. Not something I would ever consider using in anything I actually wanted to function.
Image
Tycho: "I don't know why people ever, ever try to stop nerds from doing things. It's really the most incredible waste of time."
Adam Savage: "I reject your reality and substitute my own!"

User avatar
Retrofuturist
Posts: 3131
Joined: 2008.09.19 (06:55)
MBTI Type: ENTP
Location: California, USA
Contact:

Postby t̷s͢uk̕a͡t͜ư » 2010.11.18 (04:07)

smartalco wrote:
T̷s͢uk̕a͡t͜ư wrote:Extremely relevant to previous conversation:
http://www.reddit.com/r/programming/com ... variables/

And if you're particularly interested in this specific problem, some further reading.
That is fucking awesome. And by 'fucking awesome' I mean 'fucking awesome if you want to write some really fucked up obfuscated code, or just play around with a language'. Not something I would ever consider using in anything I actually wanted to function.
"Awesome." There's an interesting word to reach for. I was thinking more along the lines of "horrifying".
[spoiler="you know i always joked that it would be scary as hell to run into DMX in a dark ally, but secretly when i say 'DMX' i really mean 'Tsukatu'." -kai]"... and when i say 'scary as hell' i really mean 'tight pink shirt'." -kai[/spoiler][/i]
spoiler

Image



Who is online

Users browsing this forum: No registered users and 6 guests