July 12, 2005
>> Now throws an ArrayBoundsError if accessing an associative array with a key that is not already in the array. Previously, the key would be added to the array.

All my work depends on previous behavior. My business logic is based on it. About 1 year of work, and this is not only hobby, but I was also hoping to get some commercial proffit from it.

Why should it throw an error? Take PHP, it does not give you an error on that occation. I have implemented a scripting language (in my project) and assosiative arrays have been much imporantce the way they where.

In my mind the correct behaviour would be return the type default value if the element is not present (why waste memory in creating it) and not give an error.

Or if you like there could be a keyword like 'loose' (opposite of strict) and in that the AA-s would not throw an error but give type default value.

Certanly the old (or old like) behavior is VERY important.

By the way does someone have 0.0125 for me? I might be stuck with it for a very long time.


July 12, 2005
In article <db16tr$1bnc$1@digitaldaemon.com>, Martin Desperate says...
>
>>> Now throws an ArrayBoundsError if accessing an associative array with a key that is not already in the array. Previously, the key would be added to the array.
>
>All my work depends on previous behavior. My business logic is based on it. About 1 year of work, and this is not only hobby, but I was also hoping to get some commercial proffit from it.

Okay, so I don't plan to make any money off of D, but you do realize D's still in beta testing, right? We're getting a sneak peak at the movie, but the director might yet decide to film an alternate ending based on our input (or even skip the theatres entirely and go directly to DVD).

..snip...

>By the way does someone have 0.0125 for me? I might be stuck with it for a very long time.

I hope you mean DMD 0.125 because I'm pretty sure no one has version 0.0125.

From http://www.digitalmars.com/d/changelog.html#new0125, http://ftp.digitalmars.com/dmd.125.zip

jcc7
July 12, 2005
Thank you for your answer.
Yes I mean the 0.125, thank you, I didn't notice that now it can be downloaded
from that place.

>Okay, so I don't plan to make any money off of D, but you do realize D's still in beta testing, right? We're getting a sneak peak at the movie, but the director might yet decide to film an alternate ending based on our input (or even skip the theatres entirely and go directly to DVD).

Ok, but what should I do? I don't like PHP at all, it very easy to write low
quality code in it but very hard to write high quality.
I did my last web application in C++ and it was no fun att all.
The best solution would be Java servkets and jsp, but I am no fan of Java and
Java is also much slower than D.

Using D 0.125 would be still better than to use other languages for know. (And
for future then it might be wise for me to write a code reconverter or
something.)
But it would still be quite frustrating this change, also because I think the
AA-s had some point as they where before. (Or better as I described: not
creating an element just returning default value.)







In article <db17n1$1clo$1@digitaldaemon.com>, J C Calvarese says...
>
>In article <db16tr$1bnc$1@digitaldaemon.com>, Martin Desperate says...
>>
>>>> Now throws an ArrayBoundsError if accessing an associative array with a key that is not already in the array. Previously, the key would be added to the array.
>>
>>All my work depends on previous behavior. My business logic is based on it. About 1 year of work, and this is not only hobby, but I was also hoping to get some commercial proffit from it.
>
>Okay, so I don't plan to make any money off of D, but you do realize D's still in beta testing, right? We're getting a sneak peak at the movie, but the director might yet decide to film an alternate ending based on our input (or even skip the theatres entirely and go directly to DVD).
>
>..snip...
>
>>By the way does someone have 0.0125 for me? I might be stuck with it for a very long time.
>
>I hope you mean DMD 0.125 because I'm pretty sure no one has version 0.0125.
>
>From http://www.digitalmars.com/d/changelog.html#new0125, http://ftp.digitalmars.com/dmd.125.zip
>
>jcc7


July 12, 2005
Maybe there should be a get method for AA-s that acts differently from just
reading the value.
b=M["first"];
b=M.get("first")

So both ways are covered.
I would suggest that the .get will raise an error and the other one just return
a value. I someone want's to write a strict code then this someone wouldn't mind
to write some more letters (but not other way around).
Or make it other way arond if you want. But it is VERY inportant that these
arrays could be used both ways!


In article <db18ip$1ddf$1@digitaldaemon.com>, Martin Desperate says...
>
>Thank you for your answer.
>Yes I mean the 0.125, thank you, I didn't notice that now it can be downloaded
>from that place.
>
>>Okay, so I don't plan to make any money off of D, but you do realize D's still in beta testing, right? We're getting a sneak peak at the movie, but the director might yet decide to film an alternate ending based on our input (or even skip the theatres entirely and go directly to DVD).
>
>Ok, but what should I do? I don't like PHP at all, it very easy to write low
>quality code in it but very hard to write high quality.
>I did my last web application in C++ and it was no fun att all.
>The best solution would be Java servkets and jsp, but I am no fan of Java and
>Java is also much slower than D.
>
>Using D 0.125 would be still better than to use other languages for know. (And
>for future then it might be wise for me to write a code reconverter or
>something.)
>But it would still be quite frustrating this change, also because I think the
>AA-s had some point as they where before. (Or better as I described: not
>creating an element just returning default value.)
>
>
>
>
>
>
>
>In article <db17n1$1clo$1@digitaldaemon.com>, J C Calvarese says...
>>
>>In article <db16tr$1bnc$1@digitaldaemon.com>, Martin Desperate says...
>>>
>>>>> Now throws an ArrayBoundsError if accessing an associative array with a key that is not already in the array. Previously, the key would be added to the array.
>>>
>>>All my work depends on previous behavior. My business logic is based on it. About 1 year of work, and this is not only hobby, but I was also hoping to get some commercial proffit from it.
>>
>>Okay, so I don't plan to make any money off of D, but you do realize D's still in beta testing, right? We're getting a sneak peak at the movie, but the director might yet decide to film an alternate ending based on our input (or even skip the theatres entirely and go directly to DVD).
>>
>>..snip...
>>
>>>By the way does someone have 0.0125 for me? I might be stuck with it for a very long time.
>>
>>I hope you mean DMD 0.125 because I'm pretty sure no one has version 0.0125.
>>
>>From http://www.digitalmars.com/d/changelog.html#new0125, http://ftp.digitalmars.com/dmd.125.zip
>>
>>jcc7
>
>


July 12, 2005
If you like you can use the Indigo associative containers. They are quite easy to learn, also fast, and have unambiguous member functions that do what their Qt equivalents do. And the rvalue index does not throw an exception, does not insert values, but returns the default value.

Ciao
uwe
July 12, 2005
Why not a quick grep, and just replace with

"key" in aa ? value = aa["key"] : aa["key"] = valueType.init;

?

I dont like either behavior really ( old or new ) , but the new _is_ the
lesser evil ;).

Charlie

"Martin" <Martin_member@pathlink.com> wrote in message news:db19ec$1e46$1@digitaldaemon.com...
> Maybe there should be a get method for AA-s that acts differently from
just
> reading the value.
> b=M["first"];
> b=M.get("first")
>
> So both ways are covered.
> I would suggest that the .get will raise an error and the other one just
return
> a value. I someone want's to write a strict code then this someone
wouldn't mind
> to write some more letters (but not other way around).
> Or make it other way arond if you want. But it is VERY inportant that
these
> arrays could be used both ways!
>
>
> In article <db18ip$1ddf$1@digitaldaemon.com>, Martin Desperate says...
> >
> >Thank you for your answer.
> >Yes I mean the 0.125, thank you, I didn't notice that now it can be
downloaded
> >from that place.
> >
> >>Okay, so I don't plan to make any money off of D, but you do realize D's
still
> >>in beta testing, right? We're getting a sneak peak at the movie, but the director might yet decide to film an alternate ending based on our input
(or
> >>even skip the theatres entirely and go directly to DVD).
> >
> >Ok, but what should I do? I don't like PHP at all, it very easy to write
low
> >quality code in it but very hard to write high quality.
> >I did my last web application in C++ and it was no fun att all.
> >The best solution would be Java servkets and jsp, but I am no fan of Java
and
> >Java is also much slower than D.
> >
> >Using D 0.125 would be still better than to use other languages for know.
(And
> >for future then it might be wise for me to write a code reconverter or
> >something.)
> >But it would still be quite frustrating this change, also because I think
the
> >AA-s had some point as they where before. (Or better as I described: not creating an element just returning default value.)
> >
> >
> >
> >
> >
> >
> >
> >In article <db17n1$1clo$1@digitaldaemon.com>, J C Calvarese says...
> >>
> >>In article <db16tr$1bnc$1@digitaldaemon.com>, Martin Desperate says...
> >>>
> >>>>> Now throws an ArrayBoundsError if accessing an associative array
with a key that is not already in the array. Previously, the key would be added to the array.
> >>>
> >>>All my work depends on previous behavior. My business logic is based on
it.
> >>>About 1 year of work, and this is not only hobby, but I was also hoping
to get
> >>>some commercial proffit from it.
> >>
> >>Okay, so I don't plan to make any money off of D, but you do realize D's
still
> >>in beta testing, right? We're getting a sneak peak at the movie, but the director might yet decide to film an alternate ending based on our input
(or
> >>even skip the theatres entirely and go directly to DVD).
> >>
> >>..snip...
> >>
> >>>By the way does someone have 0.0125 for me? I might be stuck with it
for a very
> >>>long time.
> >>
> >>I hope you mean DMD 0.125 because I'm pretty sure no one has version
0.0125.
> >>
> >>From http://www.digitalmars.com/d/changelog.html#new0125, http://ftp.digitalmars.com/dmd.125.zip
> >>
> >>jcc7
> >
> >
>
>


July 12, 2005
Ok, maybe Iover reacted a bit before.
If it would be possible to use the old (or oldlike) behaviour somehow (for
example .get) then I could rewrite my code. But without it would be quite sad.
Or far better, with :strict and :loose, see the end of my mail please.

I can see that both uses of AA is very important. In some cases you use const
string values. Like
char [][char []][]M
what you can use to store the result of a an sql query (like M[5]["id"]). In
that case you really want to get an error if you misspelled.

In other cases is the opposite. For exaple I have the array char []POST[char []] where I store the post values i get from user. It is very convinient just to assume that "" means no value was sent . And if the behavior would be that it only returns default value, not creats the element, then I could use the in operator to check if the value was really sent. (Just rewturning default and not creating anything is thread safe but still fairly close to previous behaviour) In many cases in AA (atleast in my code) no element and default value mean the same thing. And the difference between these is not important.

I think that maybe this time, just this time we could trust the programmer who writes the code.

I mean there could be
int K[char[] : loose]
or
int K[char[] : strict]

The strict could be default.

I mean the programmer can't be plain stupid. For example he has to know if he
uses double of int variables.
Ofcourse we could assume that he is and require that type double variables must
be written in capital letters. But we don't do so.

So he must be abble to tell the variable he uses is double or int, in that same way he should be abble to tell if the AA he is using is strict or loose.

I think if D goes to be a very strict (too strict) language, it is not good!

What you think?



July 12, 2005
Martin Desperate wrote:
> 
> Ok, but what should I do? I don't like PHP at all, it very easy to write low
> quality code in it but very hard to write high quality.
> I did my last web application in C++ and it was no fun att all. The best solution would be Java servkets and jsp, but I am no fan of Java and
> Java is also much slower than D.
> 
> Using D 0.125 would be still better than to use other languages for know. (And
> for future then it might be wise for me to write a code reconverter or
> something.)
> But it would still be quite frustrating this change, also because I think the
> AA-s had some point as they where before. (Or better as I described: not
> creating an element just returning default value.)

Maybe it's a little too late now, but for future reference: try writing a wrapper class around AA's, and use that class, and call its method.
If D's implementation of AA changes, all you have to do is change few lines in your AA class.
July 12, 2005
Thank you.

I think I should do some kind of grepping, but it won't be easy because I have
quite complex issues like M[K["n_"~getqt(s)]~"_standard"][5] (where both M and K
are AA-s) and so on.

>>I dont like either behavior really ( old or new )

What would you like?

Regards,
Martin



In article <db1aq5$1fa7$1@digitaldaemon.com>, Charles says...
>
>Why not a quick grep, and just replace with
>
>"key" in aa ? value = aa["key"] : aa["key"] = valueType.init;
>
>?
>
>I dont like either behavior really ( old or new ) , but the new _is_ the
>lesser evil ;).
>
>Charlie
>
>"Martin" <Martin_member@pathlink.com> wrote in message news:db19ec$1e46$1@digitaldaemon.com...
>> Maybe there should be a get method for AA-s that acts differently from
>just
>> reading the value.
>> b=M["first"];
>> b=M.get("first")
>>
>> So both ways are covered.
>> I would suggest that the .get will raise an error and the other one just
>return
>> a value. I someone want's to write a strict code then this someone
>wouldn't mind
>> to write some more letters (but not other way around).
>> Or make it other way arond if you want. But it is VERY inportant that
>these
>> arrays could be used both ways!
>>
>>
>> In article <db18ip$1ddf$1@digitaldaemon.com>, Martin Desperate says...
>> >
>> >Thank you for your answer.
>> >Yes I mean the 0.125, thank you, I didn't notice that now it can be
>downloaded
>> >from that place.
>> >
>> >>Okay, so I don't plan to make any money off of D, but you do realize D's
>still
>> >>in beta testing, right? We're getting a sneak peak at the movie, but the director might yet decide to film an alternate ending based on our input
>(or
>> >>even skip the theatres entirely and go directly to DVD).
>> >
>> >Ok, but what should I do? I don't like PHP at all, it very easy to write
>low
>> >quality code in it but very hard to write high quality.
>> >I did my last web application in C++ and it was no fun att all.
>> >The best solution would be Java servkets and jsp, but I am no fan of Java
>and
>> >Java is also much slower than D.
>> >
>> >Using D 0.125 would be still better than to use other languages for know.
>(And
>> >for future then it might be wise for me to write a code reconverter or
>> >something.)
>> >But it would still be quite frustrating this change, also because I think
>the
>> >AA-s had some point as they where before. (Or better as I described: not creating an element just returning default value.)
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >In article <db17n1$1clo$1@digitaldaemon.com>, J C Calvarese says...
>> >>
>> >>In article <db16tr$1bnc$1@digitaldaemon.com>, Martin Desperate says...
>> >>>
>> >>>>> Now throws an ArrayBoundsError if accessing an associative array
>with a key that is not already in the array. Previously, the key would be added to the array.
>> >>>
>> >>>All my work depends on previous behavior. My business logic is based on
>it.
>> >>>About 1 year of work, and this is not only hobby, but I was also hoping
>to get
>> >>>some commercial proffit from it.
>> >>
>> >>Okay, so I don't plan to make any money off of D, but you do realize D's
>still
>> >>in beta testing, right? We're getting a sneak peak at the movie, but the director might yet decide to film an alternate ending based on our input
>(or
>> >>even skip the theatres entirely and go directly to DVD).
>> >>
>> >>..snip...
>> >>
>> >>>By the way does someone have 0.0125 for me? I might be stuck with it
>for a very
>> >>>long time.
>> >>
>> >>I hope you mean DMD 0.125 because I'm pretty sure no one has version
>0.0125.
>> >>
>> >>From http://www.digitalmars.com/d/changelog.html#new0125, http://ftp.digitalmars.com/dmd.125.zip
>> >>
>> >>jcc7
>> >
>> >
>>
>>
>
>


July 13, 2005
"M" <M_member@pathlink.com> wrote in message news:db1cpm$1h6e$1@digitaldaemon.com...
> Thank you.
>
> I think I should do some kind of grepping, but it won't be easy because I
> have
> quite complex issues like M[K["n_"~getqt(s)]~"_standard"][5] (where both M
> and K
> are AA-s) and so on.

out of curiosity, what is the type of M? If the value type is a dynamic array then the [5] would end up throwing an ArrayIndexException if "_standard" wasn't in the map since inserting "_standard" would have set the value to be an empty array. If the value type was a static array then the [5] would work but my assumption is that "_standard" shouldn't be a key M.


« First   ‹ Prev
1 2
Top | Discussion index | About this forum | D home