Page 1 of 1

Alternative for ARRAY keyword

Posted: Mon Sep 27, 2010 3:40 pm
by John Cartwright
So I have this data factory class (seen below), which will populate the correct data container object with it's data depending on what type of data your specifying it as (or leaving it to auto detect if none specified). However, this is not my issue and just wanted to give a little background.

Now, my problem is ARRAY is a reserved word in PHP. So, instead of ARRAY, I have used the word COLLECTION. This doesn't quite sit well with me, and was wondering if anyone thought this was a good substitute or if they can recommend something better.

I know I'm kind of knit picking, but was just curious about public opinion.

Thanks!

Code: Select all

class Northern_Data
{
	const CURRENCY 	 = 'Northern_Data_Currency';
	const INT32 	 = 'Northern_Data_Int32';
	const INT64 	 = 'Northern_Data_Int64';
	const STRING     = 'Northern_Data_String';
	const COLLECTION = 'Northern_Data_Collection';
 
        //snip snip
}

Re: Alternative for ARRAY keyword

Posted: Mon Sep 27, 2010 3:55 pm
by DigitalMind
DIM, DIMENSION (like in Basic) :)
SET
but COLLECTION is good enough name. Maybe it's even the best choice for this case. :)

Re: Alternative for ARRAY keyword

Posted: Mon Sep 27, 2010 3:58 pm
by Eran
I like LIST

Re: Alternative for ARRAY keyword

Posted: Mon Sep 27, 2010 4:01 pm
by DigitalMind
pytrin wrote:I like LIST
Yes, that's also good name for 1D arrays

Re: Alternative for ARRAY keyword

Posted: Mon Sep 27, 2010 4:02 pm
by John Cartwright
LIST was what I was looking for! Thanks for all the good suggestions guys.

Re: Alternative for ARRAY keyword

Posted: Mon Sep 27, 2010 11:55 pm
by josh
You have a problem with array but not string? Its the inconsistency that kills me. Why not rename 'string' to 'text', either that or just 'array' to be consistent. I prefer 'array' if its a framework intended for programmer's consumption. As far as I know, if you won't need to create a function called array() you won't run into a reserved name issues. I name variables as $return and things like that all the time, no issues. A lot of old school programmers call it a bad practice but I don't see how. In Java or C++ or Ruby, maybe.... PHP not so much.