Page 5 of 5 [ 67 posts ]  Go to page Previous  1, 2, 3, 4, 5

lau
Veteran
Veteran

User avatar

Joined: 17 Jun 2006
Age: 76
Gender: Male
Posts: 9,795
Location: Somerset UK

10 Apr 2007, 3:00 pm

0_equals_true wrote:
Lau wrote:
Yes it is. It is defined as such. The fact that it requires its parameter to be a variable, and can detect an error at compile time, rather than runtime, doesn't stop it being a function.

Not in terms of php it’s not.
Ah, but there you may (now) be wrong. I've just looked at http://www.php.net/manual/en/function.empty.php. Versus other links where "empty" seems to be a function or not as the whim takes it, that seems to be a fairly authoritative site, and they have quietly dropped the "not a function" bit. It still lists "empty" as a syntactic token, which is pretty silly. It should have been just demoted to semantics.

0_equals_true wrote:
Have you not heard of Duck Typing?
I don't think I had. Or maybe I had and I'd not bothered to long-term-remember it.

0_equals_true wrote:
I was demonstrating that nothing is a special case. Like for example in Ruby 0 is part of the FixNum object class as is 1,2 3... so it shouldn't be treated as a special case. As FixNum objects evaluate to true 0 does. Why should it be a special case?
I think we're into the realms of "Why shouldn't false be the same as true? why make a special case of false?". Mind you, in Lisp, that would be the case. IIRC true is T and false is F and T is true but so is F.


_________________
"Striking up conversations with strangers is an autistic person's version of extreme sports." Kamran Nazeer


Last edited by lau on 10 Apr 2007, 4:40 pm, edited 1 time in total.

0_equals_true
Veteran
Veteran

User avatar

Joined: 5 Apr 2007
Age: 42
Gender: Male
Posts: 11,038
Location: London

10 Apr 2007, 4:39 pm

Lau wrote:
Not in terms of php it’s not. Ah, but there you may (now) be wrong. I've just looked at http://www.php.net/manual/en/function.empty.php. Versus other links where "empty" seems to be a function or not as the whim takes it, that seems to be a fairly authoritative site, and they have quietly dropped the "not a function" bit. It still lists "empty" as a syntactic token, which is pretty silly. It should have been just demoted to semantics.

It is pretty silly that's what I'm trying to say. You have to look there logic for doing so. They wanted a kind of opposite to var but not quite. It is no different (or better) than !$x except it will check inside an array to see it has values. Actually the zero equals true is quite poignant because with empty "0" and 0 return true (well as of php 4 :lol: ). So they obviously got a bit confused. But because of implicit types they had to choose which way they are going to convert "0" and 0 either to string or number. Whereas why not treat 0 and "0" evaluating to true no conversion necessary? No special case i.e. "1" and 1 is treated the same. If I input 0, I want 0!! !. Trying to make it like 'real world' is bad I don't think that is what OO should be about.

Lau wrote:
I don't think I had. Or maybe I had and I'd not bothered to long-term-remember it.

No worries:) my memory is pretty bad.

Lau wrote:
I think we're into thje realms of "Why shouldn't false be the same as true? why make a special case of false?". Mind you, in Lisp, that would be the case. IIRC true is T and false is F and T is true but so is F.

In the case of ruby it is about being consistent 0 is in FixNum class. nil and false have their own classes so they are not inconsistent. I'm not saying you can't have uniqueness that would be crazy.



atari
Emu Egg
Emu Egg

User avatar

Joined: 16 Apr 2007
Gender: Male
Posts: 2

19 Apr 2007, 10:36 pm

Well, I have programmed a lot. Mostly in a few languages but I have tried most of them in use in 1990.

I HATED SmallTalk's use of OOP. It was more of an obstacle than a tool for me.

I couldn't stand early augmented implementations of OOP in C. I think C++ was the first one to get it right.

I got used to Java, but its strict OOP style is a pain for fast coding.

I prefer Visual Basic OOP style, which is not quite true OOP, but I like it anyway.

I really like most procedural languages. I remember grinding out code in REXX in the morning, BAL at 2PM, two flavors of C at night, and 680x or x86 assembler the next day, and then some SQL and Visual Basic Script the day after. The transitions seemed to be near effortless back then

I hated APL, Lisp, and Prolog. I could never get my mind to think the way they required me to think.

I have had trouble get Perl, HTML, CSS, and PHP to stick with me since I, being a network guy now, don't code for work much anymore.

I really don't like how OOP was hyped. It is NOT more natural for me, but it does have its place.

Sometimes, though, I had wished the OOP languages had not been such a hinderance when I was developing programs, but I was thankful for their help when I had to debug someone else's code. All in all though, I don't think it was worth the trouble for me.

Just my PI cents