Why doesn't == do that? O_oGeti wrote:So you can check for identical types as well as values? O_oincluye wrote:Why does === exist?
Metanet Programmer Directory
-
- 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:

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

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!"
- Depressing
- Posts: 1977
- Joined: 2008.09.26 (06:46)
- NUMA Profile: http://nmaps.net/user/rennaT
- MBTI Type: ISTJ
- Location: Trenton, Ontario, Canada
- Contact:
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.smartalco wrote:Because more often you would want to know something like if the string '0' is equal to the value zero.

'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:
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: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.smartalco wrote:Because more often you would want to know something like if the string '0' is equal to the value zero.
Code: Select all
<?php # prints out nothing
if("0") print "hello";
if(0) print "hello";
if("") print "hello";
if(0.0) print "hello";

-
- 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:
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.incluye wrote: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: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.Code: Select all
<?php # prints out nothing if("0") print "hello"; if(0) print "hello"; if("") print "hello"; if(0.0) print "hello";
because if you can't, you use a different language. simple.

辻菜摘が好きじゃー ヽ(´ー`)ノ sig by peking duck
- Retrofuturist
- Posts: 3131
- Joined: 2008.09.19 (06:55)
- MBTI Type: ENTP
- Location: California, USA
- Contact:
The point is that this is bad programming practice, and PHP, by encouraging this kind of bullshit, will build bad programming habits.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.
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.

-
- 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:
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.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.
it was inevitable that a programming thread would end up a language bashing thread.

辻菜摘が好きじゃー ヽ(´ー`)ノ sig by peking duck
- 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:
@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'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
-
- 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:
TEXTMATE \m/Geti wrote:I'm just surprised we haven't got back onto editor wars yet.

- 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
- Lifer
- Posts: 1099
- Joined: 2008.09.26 (21:35)
- NUMA Profile: http://nmaps.net/user/smartalco
- MBTI Type: INTJ

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!"
- 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
And they can be fast, too.smartalco wrote:Dynamically typed variables are the shit, as the kids say.
- Retrofuturist
- Posts: 3131
- Joined: 2008.09.19 (06:55)
- MBTI Type: ENTP
- Location: California, USA
- Contact:
I'm talking about the entirety of PHP's style.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
http://harmful.cat-v.org/software/c++/coders-at-workscythe wrote:Not C++, though it's a decent language that is simply misunderstood.

- 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:
@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?
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.incluye wrote:TEXTMATE \m/

"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
- Retrofuturist
- Posts: 3131
- Joined: 2008.09.19 (06:55)
- MBTI Type: ENTP
- Location: California, USA
- Contact:

- 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
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.
- Retrofuturist
- Posts: 3131
- Joined: 2008.09.19 (06:55)
- MBTI Type: ENTP
- Location: California, USA
- Contact:
You forgot "and 2,500 times the size" (javac'd Hello World was ~400 bytes).scythe wrote:[Go] turned out to be compiled Java, only not a total piece of shit, but twice as slow.

- 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:
Oh hey there was other articles on that site that I probably needed to read. Thank you for that.T̷s͢uk̕a͡t͜ư wrote:http://harmful.cat-v.org/software/c++/coders-at-work

- Retrofuturist
- Posts: 3131
- Joined: 2008.09.19 (06:55)
- MBTI Type: ENTP
- Location: California, USA
- Contact:
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.GamingWolf wrote:Oh hey there was other articles on that site that I probably needed to read. Thank you for that.T̷s͢uk̕a͡t͜ư wrote:http://harmful.cat-v.org/software/c++/coders-at-work
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.

-
- Plus (Size) Member
- Posts: 42
- Joined: 2008.09.27 (02:56)
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).T̷s͢uk̕a͡t͜ư wrote: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.GamingWolf wrote:Oh hey there was other articles on that site that I probably needed to read. Thank you for that.T̷s͢uk̕a͡t͜ư wrote:http://harmful.cat-v.org/software/c++/coders-at-work
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.
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
- 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
Qt, though, is awesome. I can agree that C++ is all-too-often terrible, but in the form of Qt it's great.T̷s͢uk̕a͡t͜ư wrote:http://harmful.cat-v.org/software/c++/coders-at-workscythe wrote:Not C++, though it's a decent language that is simply misunderstood.
- Retrofuturist
- Posts: 3131
- Joined: 2008.09.19 (06:55)
- MBTI Type: ENTP
- Location: California, USA
- Contact:
http://www.reddit.com/r/programming/com ... variables/
And if you're particularly interested in this specific problem, some further reading.

- Lifer
- Posts: 1099
- Joined: 2008.09.26 (21:35)
- NUMA Profile: http://nmaps.net/user/smartalco
- MBTI Type: INTJ
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.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.

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!"
- Retrofuturist
- Posts: 3131
- Joined: 2008.09.19 (06:55)
- MBTI Type: ENTP
- Location: California, USA
- Contact:
"Awesome." There's an interesting word to reach for. I was thinking more along the lines of "horrifying".smartalco wrote: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.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.

Who is online
Users browsing this forum: No registered users and 6 guests