473,466 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

array() VS Array()

which one is recommend?

seems they perform the same thing...
regards,
howa

May 13 '06 #1
22 2024
ho******@gmail.com wrote:
which one is recommend?

seems they perform the same thing...


The lowercase notation, because the case-insensitive handling of function-
and language construct names might be removed from future PHP versions and
'array' is the preferred notation.
JW
May 13 '06 #2

"Janwillem Borleffs" <jw@jwscripts.com> wrote in message
news:44***********************@news.euronet.nl...
ho******@gmail.com wrote:
which one is recommend?

seems they perform the same thing...


The lowercase notation, because the case-insensitive handling of function-
and language construct names might be removed from future PHP versions and
'array' is the preferred notation.


The removal of case-insensitive functions names would be a totally WRONG
move IMHO as it would serve no useful purpose. The argument "to be
consistent with other languages" just does not hold water as it would be
doing nothing but perpetuating a bad idea. If having case-insensitive names
does not cause a problem then it does not need a solution.

--
Tony Marston

http://www.tonymarston.net
http://www.radicore.org
May 14 '06 #3
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in message
news:e4*******************@news.demon.co.uk...

"Janwillem Borleffs" <jw@jwscripts.com> wrote in message
news:44***********************@news.euronet.nl...
ho******@gmail.com wrote:
which one is recommend?

seems they perform the same thing...


The lowercase notation, because the case-insensitive handling of
function- and language construct names might be removed from future PHP
versions and 'array' is the preferred notation.


The removal of case-insensitive functions names would be a totally WRONG
move IMHO as it would serve no useful purpose. The argument "to be
consistent with other languages" just does not hold water as it would be
doing nothing but perpetuating a bad idea. If having case-insensitive
names does not cause a problem then it does not need a solution.

Surely we've all heard your opinion and in fact it was discussed a lot some
time ago. Now let it rest. You can write aRRaY() for all I care, but if
someone asks if there is a preference, I see no harm done if one is
recommended. But noooo... You just _had_ to tell once again how much you
hate the case-sensitivity, didn't you? As if it were the end of the world.

--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
sp**@outolempi.net | Gedoon-S @ IRCnet | rot13(xv***@bhgbyrzcv.arg)
May 15 '06 #4
On Sun, 14 May 2006 16:38:26 +0100, Tony Marston wrote:
The removal of case-insensitive functions names would be a totally WRONG
move IMHO as it would serve no useful purpose. The argument "to be
consistent with other languages"


I'd say a better argument would be so it's consistent with itself.
Variable names and member variables are case-sensitive so it's counter
intuitive to a beginner to have the language partially case-sensitive.

Just MHO....

Cheers,
Andy
--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

May 15 '06 #5

"Andy Jeffries" <ne**@andyjeffries.co.uk> wrote in message
news:pa****************************@andyjeffries.c o.uk...
On Sun, 14 May 2006 16:38:26 +0100, Tony Marston wrote:
The removal of case-insensitive functions names would be a totally WRONG
move IMHO as it would serve no useful purpose. The argument "to be
consistent with other languages"


I'd say a better argument would be so it's consistent with itself.
Variable names and member variables are case-sensitive so it's counter
intuitive to a beginner to have the language partially case-sensitive.

Just MHO....


But if a language allows the same name to mean different things if specified
in a different case this could lead to code which is confusing and therefore
difficult to maintain. It *should* be the primary objective of every
language to avoid such features instead of deliberately implementing them.
This is why the GOT verb is frowned upon and excluded from many languages,
and why the ALTER verb in COBOL is considered an absolute no-no.

In the English language a word has only one meaning regardless of case (such
as 'dog', 'Dog' and 'DOG') so why should computer languages be any
different?

--
Tony Marston

http://www.tonymarston.net
http://www.radicore.org

May 15 '06 #6
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in message
news:e4*******************@news.demon.co.uk...

"Andy Jeffries" <ne**@andyjeffries.co.uk> wrote in message
news:pa****************************@andyjeffries.c o.uk...
On Sun, 14 May 2006 16:38:26 +0100, Tony Marston wrote:
The removal of case-insensitive functions names would be a totally WRONG
move IMHO as it would serve no useful purpose. The argument "to be
consistent with other languages"


I'd say a better argument would be so it's consistent with itself.
Variable names and member variables are case-sensitive so it's counter
intuitive to a beginner to have the language partially case-sensitive.

Just MHO....


But if a language allows the same name to mean different things if
specified in a different case this could lead to code which is confusing
and therefore difficult to maintain. It *should* be the primary objective
of every language to avoid such features instead of deliberately
implementing them. This is why the GOT verb is frowned upon and excluded
from many languages, and why the ALTER verb in COBOL is considered an
absolute no-no.

In the English language a word has only one meaning regardless of case
(such as 'dog', 'Dog' and 'DOG') so why should computer languages be any
different?

WeLL IF that IS iNdEED the CAse That CapS Don'T MATTER at all in ENgliSH
then why DO You SupPose We HaVE them IN thE FIRST PlacE? If IT dOEsN'T MAKE
AnY DIFfeRence TheN WHY is Writing likE This annoying? I say that they DO
have more than one meaning. Why do we write spoken languagues like English
starting each sentence or name with a capital letter and the rest in small
letters? It's just a set of rules, and when spoken the caps doen't mean
anything.

Why do we have these rules then? To distinct certain differences, to improve
readability of the writing. For instance 'Jack' and 'jack' mean different
things. With a capital J Jack is someone's name, but with a lower case j it
could mean a microphone plug or a jack hammer. Equally in PHP it's common
practise that defined constants are written with CAPITALS and mostly
everything else in lowercase. Likewise it's traditional to write SQL
KEYWORDS in capital and fieldnames in lowercase in an SQL query. There _is_
a difference between small and capitals, you just fail to see it because
you're clinging to the fact that PHP is a spoken language (which it is not).

--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
sp**@outolempi.net | Gedoon-S @ IRCnet | rot13(xv***@bhgbyrzcv.arg)
May 15 '06 #7
I must say I agree with parent. A good example would be the subtle
difference between "God" and "god". These do *not* mean the same thing.
"Kimmo Laine" <sp**@outolempi.net> wrote in message
news:yM*****************@reader1.news.jippii.net.. .
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in message
news:e4*******************@news.demon.co.uk...

"Andy Jeffries" <ne**@andyjeffries.co.uk> wrote in message
news:pa****************************@andyjeffries.c o.uk...
On Sun, 14 May 2006 16:38:26 +0100, Tony Marston wrote:
The removal of case-insensitive functions names would be a totally
WRONG
move IMHO as it would serve no useful purpose. The argument "to be
consistent with other languages"

I'd say a better argument would be so it's consistent with itself.
Variable names and member variables are case-sensitive so it's counter
intuitive to a beginner to have the language partially case-sensitive.

Just MHO....


But if a language allows the same name to mean different things if
specified in a different case this could lead to code which is confusing
and therefore difficult to maintain. It *should* be the primary objective
of every language to avoid such features instead of deliberately
implementing them. This is why the GOT verb is frowned upon and excluded
from many languages, and why the ALTER verb in COBOL is considered an
absolute no-no.

In the English language a word has only one meaning regardless of case
(such as 'dog', 'Dog' and 'DOG') so why should computer languages be any
different?

WeLL IF that IS iNdEED the CAse That CapS Don'T MATTER at all in ENgliSH
then why DO You SupPose We HaVE them IN thE FIRST PlacE? If IT dOEsN'T
MAKE AnY DIFfeRence TheN WHY is Writing likE This annoying? I say that
they DO have more than one meaning. Why do we write spoken languagues like
English starting each sentence or name with a capital letter and the rest
in small letters? It's just a set of rules, and when spoken the caps
doen't mean anything.

Why do we have these rules then? To distinct certain differences, to
improve readability of the writing. For instance 'Jack' and 'jack' mean
different things. With a capital J Jack is someone's name, but with a
lower case j it could mean a microphone plug or a jack hammer. Equally in
PHP it's common practise that defined constants are written with CAPITALS
and mostly everything else in lowercase. Likewise it's traditional to
write SQL KEYWORDS in capital and fieldnames in lowercase in an SQL query.
There _is_ a difference between small and capitals, you just fail to see
it because you're clinging to the fact that PHP is a spoken language
(which it is not).

--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
sp**@outolempi.net | Gedoon-S @ IRCnet | rot13(xv***@bhgbyrzcv.arg)

May 15 '06 #8

"<user>" <ad**@user.euro1net.com> wrote in message
news:e4**********@news.e7even.com...
I must say I agree with parent. A good example would be the subtle
difference between "God" and "god". These do *not* mean the same thing.
In computer languages you only have variables (nouns) and functions (verbs),
so there is no such differentiation between a word being a noun and a word
being a person's (or deity's) name.

So why should the variables $dog, $Dog and $DOG mean different things?
Why should the functions dosomething(), DoSomething() and DOSOMETHING() mean
different things.

When the keyboard is replaced by a microphone (or, heaven forbid, a thought
reader) how easy (or difficult) will it be to specify the case of each
individual letter?

--
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
"Kimmo Laine" <sp**@outolempi.net> wrote in message
news:yM*****************@reader1.news.jippii.net.. .
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in message
news:e4*******************@news.demon.co.uk...

"Andy Jeffries" <ne**@andyjeffries.co.uk> wrote in message
news:pa****************************@andyjeffries.c o.uk...
On Sun, 14 May 2006 16:38:26 +0100, Tony Marston wrote:
> The removal of case-insensitive functions names would be a totally
> WRONG
> move IMHO as it would serve no useful purpose. The argument "to be
> consistent with other languages"

I'd say a better argument would be so it's consistent with itself.
Variable names and member variables are case-sensitive so it's counter
intuitive to a beginner to have the language partially case-sensitive.

Just MHO....

But if a language allows the same name to mean different things if
specified in a different case this could lead to code which is confusing
and therefore difficult to maintain. It *should* be the primary
objective of every language to avoid such features instead of
deliberately implementing them. This is why the GOT verb is frowned upon
and excluded from many languages, and why the ALTER verb in COBOL is
considered an absolute no-no.

In the English language a word has only one meaning regardless of case
(such as 'dog', 'Dog' and 'DOG') so why should computer languages be any
different?

WeLL IF that IS iNdEED the CAse That CapS Don'T MATTER at all in ENgliSH
then why DO You SupPose We HaVE them IN thE FIRST PlacE? If IT dOEsN'T
MAKE AnY DIFfeRence TheN WHY is Writing likE This annoying? I say that
they DO have more than one meaning. Why do we write spoken languagues
like English starting each sentence or name with a capital letter and the
rest in small letters? It's just a set of rules, and when spoken the caps
doen't mean anything.

Why do we have these rules then? To distinct certain differences, to
improve readability of the writing. For instance 'Jack' and 'jack' mean
different things. With a capital J Jack is someone's name, but with a
lower case j it could mean a microphone plug or a jack hammer. Equally in
PHP it's common practise that defined constants are written with CAPITALS
and mostly everything else in lowercase. Likewise it's traditional to
write SQL KEYWORDS in capital and fieldnames in lowercase in an SQL
query. There _is_ a difference between small and capitals, you just fail
to see it because you're clinging to the fact that PHP is a spoken
language (which it is not).

--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
sp**@outolempi.net | Gedoon-S @ IRCnet | rot13(xv***@bhgbyrzcv.arg)


May 15 '06 #9

"Kimmo Laine" <sp**@outolempi.net> wrote in message
news:yM*****************@reader1.news.jippii.net.. .
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in message
news:e4*******************@news.demon.co.uk...

"Andy Jeffries" <ne**@andyjeffries.co.uk> wrote in message
news:pa****************************@andyjeffries.c o.uk...
On Sun, 14 May 2006 16:38:26 +0100, Tony Marston wrote:
The removal of case-insensitive functions names would be a totally
WRONG
move IMHO as it would serve no useful purpose. The argument "to be
consistent with other languages"

I'd say a better argument would be so it's consistent with itself.
Variable names and member variables are case-sensitive so it's counter
intuitive to a beginner to have the language partially case-sensitive.

Just MHO....
But if a language allows the same name to mean different things if
specified in a different case this could lead to code which is confusing
and therefore difficult to maintain. It *should* be the primary objective
of every language to avoid such features instead of deliberately
implementing them. This is why the GOT verb is frowned upon and excluded
from many languages, and why the ALTER verb in COBOL is considered an
absolute no-no.

In the English language a word has only one meaning regardless of case
(such as 'dog', 'Dog' and 'DOG') so why should computer languages be any
different?

WeLL IF that IS iNdEED the CAse That CapS Don'T MATTER at all in ENgliSH
then why DO You SupPose We HaVE them IN thE FIRST PlacE? If IT dOEsN'T
MAKE AnY DIFfeRence TheN WHY is Writing likE This annoying?


While I agree that deliberately mixing case like is very annoying to a human
reader, I still stand by my assertion that for nouns and verbs (which can be
equated to variables and functions within a computer langage) that a change
in case does NOT change the meaning of a word..
I say that they DO have more than one meaning. Why do we write spoken
languagues like English starting each sentence or name with a capital
letter and the rest in small letters? It's just a set of rules, and when
spoken the caps doen't mean anything.
Human conventions in the construction of sentences are irrelevant to this
topic. Do you start each line of code with a capital letter?
Why do we have these rules then? To distinct certain differences, to
improve readability of the writing. For instance 'Jack' and 'jack' mean
different things. With a capital J Jack is someone's name, but with a
lower case j it could mean a microphone plug or a jack hammer
That is irrelevant as computer languages do not differentiate between words
which are nouns and words which are names. There are simply nouns
(variables) and verbs (functions).
.Equally in PHP it's common practise that defined constants are written
with CAPITALS and mostly everything else in lowercase.
Unfortunately different groups of people using different languages may
invent totally different "standards" as to what should be upper case and
what should be lower case. But why on earth should one persons preferences
be enforced on everyone else. All computer languages were originally
insensitive to case, so what arrogant moron decided to make the switch? What
was his justiification?
Likewise it's traditional to write SQL KEYWORDS in capital and fieldnames
in lowercase in an SQL query.
You would have loved the people at my previous contract. Their stanards were
totally the opposite - all keywords in lower case and all database, table,
field and user-defined function names in upper case. Why? Just because,
that's why. What a stupid argument, especially when the underlying language
didn't care.
There _is_ a difference between small and capitals, you just fail to see
it because you're clinging to the fact that PHP is a spoken language
(which it is not).


No. My point is that I have worked for over 20 years using computer
languages which were totally insensitive to case (assembler, COBOL, quiz,
quick, qtp, SPL, Rapid, Transact, Insight, Uniface, SQL) and I cannot see
any problem which is solved by making any language sensitive to case. Just
the opposite, in fact, I can only see the introducion of new problems.

--
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
May 15 '06 #10
Tony Marston wrote:
In the English language a word has only one meaning regardless of case (such
as 'dog', 'Dog' and 'DOG') so why should computer languages be any
different?


That's pretty wrong, actually. The word "dog" is a noun that refers
to canines. The word "Dog" would be a proper noun; the name of a person
or place. The word "DOG" would be an acronym.

Personally, when I see "htmlEntities()" my brain tells me that's
different from "htmlentities()", and it wouldn't be wrong, strictly
speaking.

In the end it's really just personal opinion. Yours is just one of
many, and I happen to disagree with it.
Ryan
May 15 '06 #11
Tony Marston wrote:

No. My point is that I have worked for over 20 years using computer
languages which were totally insensitive to case (assembler, COBOL, quiz,
quick, qtp, SPL, Rapid, Transact, Insight, Uniface, SQL) and I cannot see
any problem which is solved by making any language sensitive to case. Just
the opposite, in fact, I can only see the introducion of new problems.


Not this argument again. Give it up, Tony. You aren't going to change the world.

For the record - I have almost twice as many years of programming as you do,
starting with Fortran in the mid-60's. My first case sensitive language was C
in the mid 1980's - probably about the time you started programming. Over the
years I've written code in over a dozen different languages, including PL/I,
Assembler (both mainframe and PC), REXX, PASCAL, BASIC, C++ and Java.

I've seen definite advantages to case sensitivity, and have grown to like it.
For instance, I can declare a class Customer. I can then have variable names
like customer, customer1, customer2, etc. - or even an array customer[].

I find it not at all confusing. Class names start with caps. Variable names do
not. Simple and easy. And a programmer can quickly relate the variable to the
class using it.

And, as others have pointed out, use all caps anything defined as a CONSTANT.
That way you know it's a constant.

And that's the way PHP is, whether you like it or not. And if you hate it so
much, go back to COBOL or another case-insensitive language.

But don't keep bringing this topic up. It only shows how stubborn you are.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 15 '06 #12
Tony Marston:
When the keyboard is replaced by a microphone (or, heaven forbid, a thought
reader) how easy (or difficult) will it be to specify the case of each
individual letter?


Apparently NASA have developed a system which intercepts nerve
signals sent from the brain to your "speech organs" when you read to
yourself. They call it 'subvocal speech'.

'Cool'? You took the words right outta my mouth!

http://www.nasa.gov/home/hqnews/2004...al_speech.html

--
Jock

May 15 '06 #13
On Mon, 15 May 2006 11:58:50 +0100, Tony Marston wrote:
But if a language allows the same name to mean different things if
specified in a different case this could lead to code which is confusing
and therefore difficult to maintain. It *should* be the primary objective
of every language to avoid such features instead of deliberately
implementing them. This is why the GOT verb is frowned upon and excluded
from many languages, and why the ALTER verb in COBOL is considered an
absolute no-no.

In the English language a word has only one meaning regardless of case
(such as 'dog', 'Dog' and 'DOG') so why should computer languages be any
different?


Ryan's perfectly valid point aside (different capitalisation of Dog
meaning different things), I actually don't disagree with you entirely.
At least not enough to argue about.

However, I do feel any language ought to be consistent, if the variables
are case-sensitive the functions should be too. It makes the language a
lot more predictable in how it will behave.

Cheers,
Andy

--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

May 15 '06 #14

"Jerry Stuckle" <js*******@attglobal.net> wrote in message
news:Aa********************@comcast.com...
Tony Marston wrote:

No. My point is that I have worked for over 20 years using computer
languages which were totally insensitive to case (assembler, COBOL, quiz,
quick, qtp, SPL, Rapid, Transact, Insight, Uniface, SQL) and I cannot see
any problem which is solved by making any language sensitive to case.
Just the opposite, in fact, I can only see the introducion of new
problems.

Not this argument again. Give it up, Tony. You aren't going to change
the world.


I'm not arguing to change all languages back to case-insensitivty, but I am
arguiing that it should not be introduced just because someone thinks it is
"the standard".
For the record - I have almost twice as many years of programming as you
do, starting with Fortran in the mid-60's. My first case sensitive
language was C in the mid 1980's - probably about the time you started
programming.
No, I started in the 70's.
Over the years I've written code in over a dozen different languages,
including PL/I, Assembler (both mainframe and PC), REXX, PASCAL, BASIC,
C++ and Java.

I've seen definite advantages to case sensitivity, and have grown to like
it.
I've seen no advantages, only problems, so I hate it.
For instance, I can declare a class Customer. I can then have variable
names like customer, customer1, customer2, etc. - or even an array
customer[].

I find it not at all confusing. Class names start with caps. Variable
names do not. Simple and easy. And a programmer can quickly relate the
variable to the class using it.
That is just a convention among programmers, not a requirement of the
language. It is irrelevant in PHP as all variables start with a '$' and all
functions end in '()' which makes it easy to spot the difference between
$customer (variable) and customer() (function). What I object to is a
language that delierately allows you to create variables such as $customer,
$Customer and $CUSTOMER which have the same name but mean different things.
The name is important and the case should be irrelevant.
And, as others have pointed out, use all caps anything defined as a
CONSTANT. That way you know it's a constant.
In PHP it is not a requirement that a constant be defined in upper case. It
is easy to tell the difference between a constant and a variable as one has
a leading '$' while the other does not. Which of these two is the constant -
FOO or $FOO?
And that's the way PHP is, whether you like it or not. And if you hate it
so much, go back to COBOL or another case-insensitive language.

But don't keep bringing this topic up. It only shows how stubborn you
are.


All the while people like you keep harping on about how "politically
correct" it is to introduce even more unnecessary case-sensitivity into
computer languages I will keep responding with an alternative view. Case
sensitivity does not solve any problems, therefore it is an unwanted
solution.

--
Tony Marston

http://www.tonymarston.net
http://www.radicore.org

May 15 '06 #15

"Andy Jeffries" <ne**@andyjeffries.co.uk> wrote in message
news:pa****************************@andyjeffries.c o.uk...
On Mon, 15 May 2006 11:58:50 +0100, Tony Marston wrote:
But if a language allows the same name to mean different things if
specified in a different case this could lead to code which is confusing
and therefore difficult to maintain. It *should* be the primary objective
of every language to avoid such features instead of deliberately
implementing them. This is why the GOT verb is frowned upon and excluded
from many languages, and why the ALTER verb in COBOL is considered an
absolute no-no.

In the English language a word has only one meaning regardless of case
(such as 'dog', 'Dog' and 'DOG') so why should computer languages be any
different?
Ryan's perfectly valid point aside (different capitalisation of Dog
meaning different things), I actually don't disagree with you entirely.
At least not enough to argue about.


Rubbish. The letters 'd', 'o' and 'g' spell 'dog' and mean the same thing
regardless of case. take the following three sentences:-
1) beware of the dog
2) Beware Of The Dog
3) BEWARE OF THE DOG.

Do these sentences mean the same thing or not? Does the meaning change just
because the case changes?
However, I do feel any language ought to be consistent, if the variables
are case-sensitive the functions should be too. It makes the language a
lot more predictable in how it will behave.


I'm afraid that the argument that all computer languages should enforce
case-sensitivity "just to be consistent" is really pathetic. A feature
should not be introduced unless it has genuine benefits, and as the
introduction of case-sensitivity does not solve a problem it is an unwanted
solution.

--
Tony Marston

http://www.tonymarston.net
http://www.radicore.org

May 15 '06 #16
Tony Marston wrote:
All the while people like you keep harping on about how "politically
correct" it is to introduce even more unnecessary case-sensitivity into
computer languages I will keep responding with an alternative view. Case
sensitivity does not solve any problems, therefore it is an unwanted
solution.


I never said anything about "politically correct". I pointed out some real
advantages to having case sensitivity - advantages used by millions of
programmers world-wide.

And here's tony, still a stubborn mule and clinging to th dark ages, refusing to
see advantages because he doesn't want to.

You really are an ass.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 16 '06 #17

"Gary L. Burnore" <gb******@databasix.com> wrote in message
news:e4**********@blackhelicopter.databasix.com...
On Mon, 15 May 2006 23:20:58 +0100, "Tony Marston"
<to**@NOSPAM.demon.co.uk> wrote:

"Andy Jeffries" <ne**@andyjeffries.co.uk> wrote in message
news:pa****************************@andyjeffries .co.uk...
On Mon, 15 May 2006 11:58:50 +0100, Tony Marston wrote:
But if a language allows the same name to mean different things if
specified in a different case this could lead to code which is
confusing
and therefore difficult to maintain. It *should* be the primary
objective
of every language to avoid such features instead of deliberately
implementing them. This is why the GOT verb is frowned upon and
excluded
from many languages, and why the ALTER verb in COBOL is considered an
absolute no-no.

In the English language a word has only one meaning regardless of case
(such as 'dog', 'Dog' and 'DOG') so why should computer languages be
any
different?

Ryan's perfectly valid point aside (different capitalisation of Dog
meaning different things), I actually don't disagree with you entirely.
At least not enough to argue about.


Rubbish. The letters 'd', 'o' and 'g' spell 'dog' and mean the same thing
regardless of case. take the following three sentences:-
1) beware of the dog
2) Beware Of The Dog
3) BEWARE OF THE DOG.


The word god and God have different meanings to some. Does that help?


The fact that some people choose to apply different meanings is irrelevant.
I am talking about variable and function names in computer languages. Nobody
in their right minds would deliberately create three different variables
such as $foo, $Foo and $FOO as it could create confusion and lead to a
maintenance nightmare. If that isthe case then why should the language allow
that sitatio to be created in the first place?
Do these sentences mean the same thing or not? Does the meaning change
just
because the case changes?
However, I do feel any language ought to be consistent, if the variables
are case-sensitive the functions should be too. It makes the language a
lot more predictable in how it will behave.


I'm afraid that the argument that all computer languages should enforce
case-sensitivity "just to be consistent" is really pathetic.


Of course it is.


You agree with me? Well, I'll go to the foot of our stairs!

--
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
May 16 '06 #18

"Jerry Stuckle" <js*******@attglobal.net> wrote in message
news:Ze********************@comcast.com...
Tony Marston wrote:
All the while people like you keep harping on about how "politically
correct" it is to introduce even more unnecessary case-sensitivity into
computer languages I will keep responding with an alternative view. Case
sensitivity does not solve any problems, therefore it is an unwanted
solution.

I never said anything about "politically correct". I pointed out some
real advantages to having case sensitivity - advantages used by millions
of programmers world-wide.


What you are saying is that just because YOU use case-sensitivity in a
particular way in want the rest of the world to do exactly the same, and not
only that you want the language changed in such a way that other choices are
impossible.
And here's tony, still a stubborn mule and clinging to th dark ages,
refusing to see advantages because he doesn't want to.

You really are an ass.


That's just your opinion. My opinion is that being able to create variables
such as $foo, $Foo and $FOO which actually mean DIFFERENT things is a bad
idea as it be confusing and lead to a maintenance nightmare. If that is the
case then the language should not allow it. It is the prospect of
maintenance nightmares, of allowing programmers to "shoot themselves in the
foot", which caused the GOTO verb never to be implemented in PHP and its
proposed introduction by those who think it is "clever" to be resisted.

Case-sensitivity never solved any problem, so why is it a solution?

--
Tony Marston

http://www.tonymarston.net
http://www.radicore.org

May 16 '06 #19
On Mon, 15 May 2006 23:20:58 +0100, Tony Marston wrote:
However, I do feel any language ought to be consistent, if the variables
are case-sensitive the functions should be too. It makes the language a
lot more predictable in how it will behave.


I'm afraid that the argument that all computer languages should enforce
case-sensitivity "just to be consistent" is really pathetic. A feature
should not be introduced unless it has genuine benefits, and as the
introduction of case-sensitivity does not solve a problem it is an
unwanted solution.


I didn't say *all* computer languages, don't put words in my mouth.
Either that or your misread my intention.

If a language is case-sensitive for variable names and class members it
should also be consistent in that it's case-sensitive for functions and
class methods.

I'm not saying all languages should be case-sensitive, just that if one is
partially case-sensitive it should be consistently case-sensitive within
itself.

To be honest, I couldn't give a crap if Cobol, Haskell or C#/.Net is
case-sensitive, I'm a PHP programmer (at the moment) and would like my
number 1 language to be consistent.

Cheers,
Andy
--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

May 16 '06 #20
On Mon, 15 May 2006 23:14:22 +0100, Tony Marston wrote:
And, as others have pointed out, use all caps anything defined as a
CONSTANT. That way you know it's a constant.


In PHP it is not a requirement that a constant be defined in upper case.
It is easy to tell the difference between a constant and a variable as one
has a leading '$' while the other does not. Which of these two is the
constant - FOO or $FOO?


FOO could be either a constant or a reference to a function. This is
where consistent capitalisation helps clarify:

<?php
function FOO()
{
print "bar";
}

$foo = FOO;

$foo();

?>

Cheers,

Andy
--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

May 16 '06 #21
RE: Variable case
Traditionally,
FOO is read as a global literal constant, you cannot change this and is
available everywhere and is intended to be used both inside and outside
the project.
$FOO, $foo, $Foo can be read in wildly different ways. By and large i
see:

$FOO as a global variable for a specific application. Usually because
you can't pre-initialize it in the class or without doing something
before hand, and typically you don't change these, they're a
honor-system read only.
$foo is a local variable, something that only exists within the current
scope and goes away later.
$Foo i rarely see, though usually it means its important for some
reason, such as some sort of glue between a function and something
outside the function, or a reference to something within another
something-something. The point is it doesn't quite adhere to the
locality of $foo but isn't as off limits and viewable as $FOO; I like
to think of it as akin to 'protected' in OOP terminology. Occasionally
I see important public methods starting with a capital and using camel
notation, such as functions that should be called during shutdown or
startup prior to any other calls.

(Aside, this is one reason i like how perl differentiates uses with $,
#, and @, it gives me a better understanding of what context it should
be used and read in)

So, yes, traditionally, case does have an impact on the implied meaning
of what a variable does, where it is used, and so forth. You can have
case insensitivity when there are language constructs that strictly
limit how a variable is used. 'local refererence constant $foo;
global copy variable $FOO; bridging constant local $Foo' etc etc

Re: Function case
1) It would be nice to have consistancy throughout the language.
Previously, classes were stored in all lowercase, and later this was
changed to match the declared case. (Thank god!)
2) You know what to expect when you are looking for a function or
declared identifier. I declare it as 'myFunc', and its stored as
'myfunc,' but i naturally expect it to match the way I wrote it. Now I
have to write case insensitivity into determining if its the function i
want, and to verify that whatever information i'm storing is, indeed
correct? Rubbish i say.
If i call it myfunc, MYFUNC, or MyFuCn, i expect to be able to refer to
it only as how i defined it. Making it 'fuzzy' sounds sloppy and
doesn't, in my opinion, promote good coding habits. I'd much rather
have an error handler catch a programming mistake than the computer
assume it knew what i meant.
3) If i call it MYFUNC, i'm capitalizing it for a reason. Calling it
as myfunc() is not what i am expecting to look for in code if i go
reading it over and downplays the importants that this function must
server. hack_together_sql() has a different authority to it than
Hack_Together_SQL(). The former tends to imply that its a hack and
shouldn't be relied on, the latter that it is some complicated
necessity to be used with caution, and the importance of both of those
meanings should always be present in the writing of them.

Re: maintainance nightmare
You've not seen some of the 'professional' PHP code out there you can
buy? Half of them don't even spell variable names right, let alone
adhere to any sort of standard or continuity. I'd much rather pick up
any code and understand the intent of it instead of being able to skip
pressing the shift key.

Of course, thats just how I see things.

May 16 '06 #22

"Richard Levasseur" <ri********@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
RE: Variable case
Traditionally,
FOO is read as a global literal constant, you cannot change this and is
available everywhere and is intended to be used both inside and outside
the project.
$FOO, $foo, $Foo can be read in wildly different ways. By and large i
see:

$FOO as a global variable for a specific application.
Not in any language I have used, it isn't. In PHP $FOO is a local variable.
$GLOBALS['FOO'] is a global variable. In my previous language a loal
variable was defined using $name$ while a global variable used $$name. Th
case was irrelevant, it was where the $ signswere placed that
wassignificant.
Usually because
you can't pre-initialize it in the class or without doing something
before hand, and typically you don't change these, they're a
honor-system read only.
$foo is a local variable, something that only exists within the current
scope and goes away later.
$Foo i rarely see, though usually it means its important for some
reason, such as some sort of glue between a function and something
outside the function, or a reference to something within another
something-something.
There is no such meaing in any language that I have used. It is just a
variable.
The point is it doesn't quite adhere to the
locality of $foo but isn't as off limits and viewable as $FOO; I like
to think of it as akin to 'protected' in OOP terminology. Occasionally
I see important public methods starting with a capital and using camel
notation, such as functions that should be called during shutdown or
startup prior to any other calls.
That is not a standard of the language, it is merely a convention adopted by
some programmers.
(Aside, this is one reason i like how perl differentiates uses with $,
#, and @, it gives me a better understanding of what context it should
be used and read in)

So, yes, traditionally, case does have an impact on the implied meaning
of what a variable does, where it is used, and so forth.
I dispute your use of the word "traditionally". The "original" programing
languages (i'm talking Assember, COBOL, Fortran) gave absolutely no
significance to case at all, and neither did any other language I have used
right up to the 21st century. So "traditionally" in computer languages case
has been totally insignificant, it is only in a few modern languages that it
has been introduced. That was a bad move, IMHO.
You can have
case insensitivity when there are language constructs that strictly
limit how a variable is used. 'local refererence constant $foo;
global copy variable $FOO; bridging constant local $Foo' etc etc
That terminology does not exist in PHP, so your arguments do not apply.
Re: Function case
1) It would be nice to have consistancy throughout the language.
Perpetuating a bad idea just to be "consistent" does not sound very clever
to me.
Previously, classes were stored in all lowercase, and later this was
changed to match the declared case. (Thank god!)
2) You know what to expect when you are looking for a function or
declared identifier.
What would your reaction be if you looked through the manual for a function
only tofid that it existed several times, each with a different combination
of case, and each with a different meaning? Wold this be a good idea or not?
If not, then why sould the language allow it?
I declare it as 'myFunc', and its stored as
'myfunc,' but i naturally expect it to match the way I wrote it.
But if case is insignifiant it does not mean that you have to reference it
in exactly the same case as it was defined. Spelling is significant case
should not be.
Now I
have to write case insensitivity into determining if its the function i
want, and to verify that whatever information i'm storing is, indeed
correct? Rubbish i say.
If i call it myfunc, MYFUNC, or MyFuCn, i expect to be able to refer to
it only as how i defined it.
Why? In all the languages I have used in the past I could use any case I
wanted to reference that function or variable. Case is insignificant, only
the spelling is important.
Making it 'fuzzy' sounds sloppy and
doesn't, in my opinion, promote good coding habits.
Fuzzy spelling would be bad, but in my experience fuzzy case does not make a
blind bit of difference.
I'd much rather
have an error handler catch a programming mistake than the computer
assume it knew what i meant.
3) If i call it MYFUNC, i'm capitalizing it for a reason.
That is a personal preference, not a feature of the language. Other people
have their own personal preferences.
Calling it
as myfunc() is not what i am expecting to look for in code if i go
reading it over and downplays the importants that this function must
server. hack_together_sql() has a different authority to it than
Hack_Together_SQL().
Are you saying that you would deliberately create two different functions
called hack_together_sql() and Hack_Together_SQL()? If you did that on any f
my projects I would fire you on the spot.
The former tends to imply that its a hack and
shouldn't be relied on, the latter that it is some complicated
necessity to be used with caution, and the importance of both of those
meanings should always be present in the writing of them.
That "imortance" only exists in your mind. It has no significance whatsoever
to the computer language.
Re: maintainance nightmare
You've not seen some of the 'professional' PHP code out there you can
buy?
I have been programming for over 20 years and I've seen a enormous amount of
crap code. I have also seen an enormous amount of crap standards which
forces programmers to write crap code.
Half of them don't even spell variable names right, let alone
adhere to any sort of standard or continuity.
If a variable is mis-spelled then it will cause an error that should be
picked up in testing. The trouble with standards is that there is no
standard. Each group has its own standards, and they are all different.
I'd much rather pick up
any code and understand the intent of it instead of being able to skip
pressing the shift key.
In a case-insensitive language the shift key becomes irrelevant.
Of course, thats just how I see things.


Your view on this issue is not the same as my view, yet to want to change
the world to conform to your view. I am simply speaking against those
changes.

--
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
May 18 '06 #23

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Brian | last post by:
I'm diddlying with a script, and found some behavior I don't understand. Take this snippet: for ($i = 0; $i <= count($m); $i++) { array_shift($m); reset($m); }
2
by: Stormkid | last post by:
Hi Group I'm trying to figure out a way that I can take two (two dimensional) arrays and avShed and shed, and subtract the matching elements in shed from avShed I've pasted the arrays blow from a...
15
by: lawrence | last post by:
I wanted to test xml_parse_into_struct() so I took the example off of www.php.net and put this code up on a site: <?php $simple = <<<END <item>
8
by: vcardillo | last post by:
Hello all, Okay, I am having some troubles. What I am doing here is dealing with an employee hierarchy that is stored in an array. It looks like this: $employees = array( "user_id" => array(...
12
by: Sam Collett | last post by:
How do I remove an item with a specified value from an array? i.e. array values 1,2,2,5,7,12,15,21 remove 2 from array would return 1,5,7,12,15,21 (12 and 21 are NOT removed, duplicates are...
8
by: Mike S. Nowostawsky | last post by:
I tried using the "toUpperCase()" property to change the value of an array entity to uppercase BUT it tells me that the property is invalid. It seems that an array is not considered an object when...
58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
104
by: Leszek | last post by:
Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from...
7
by: Jim Carlock | last post by:
Looking for suggestions on how to handle bad words that might get passed in through $_GET variables. My first thoughts included using str_replace() to strip out such content, but then one ends...
17
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Gurus, I need to transfer a jagged array of byte by reference to unmanaged function, The unmanaged code should changed the values of the array, and when the unmanaged function returns I need...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.