digitalmars.D - HEY !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- Martin Desperate (13/14) Jul 12 2005 All my work depends on previous behavior. My business logic is based on ...
- J C Calvarese (10/16) Jul 12 2005 Okay, so I don't plan to make any money off of D, but you do realize D's...
- Martin Desperate (15/37) Jul 12 2005 Thank you for your answer.
- Martin (11/55) Jul 12 2005 Maybe there should be a get method for AA-s that acts differently from j...
- Uwe Salomon (6/6) Jul 12 2005 If you like you can use the Indigo associative containers. They are quit...
- Charles (27/95) Jul 12 2005 Why not a quick grep, and just replace with
- M (8/109) Jul 12 2005 Thank you.
- Ben Hinkle (7/13) Jul 12 2005 out of curiosity, what is the type of M? If the value type is a dynamic
- Martin (2/16) Jul 14 2005
- Hasan Aljudy (5/18) Jul 12 2005 Maybe it's a little too late now, but for future reference: try writing
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (10/17) Jul 13 2005 Maybe we should do the same for strings too, then ? And arrays ? etc...
- Hasan Aljudy (5/34) Jul 13 2005 The problem here is that D is in beta phase, so things are almost
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (7/11) Jul 13 2005 D makes quite a point of *not* needing wrappers for strings and arrays
- Hasan Aljudy (4/15) Jul 13 2005 Yeah, I wasn't talking about D, just the OOP paradigm.
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (6/10) Jul 14 2005 Actually I just meant the naming, as I'm normally using "overloading"
- Martin (28/46) Jul 14 2005 Actually it is not a bad idea.
- Martin (32/32) Jul 12 2005 Ok, maybe Iover reacted a bit before.
- Eugene Pelekhay (4/26) Jul 13 2005 no comments :)
- Unknown W. Brackets (5/8) Jul 13 2005 PHP throws a notice and generates an "Undefined index" or "Undefined
- Ant (3/26) Jul 28 2005 How did you find all the occurrences on your code?
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.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.
Jul 12 2005
In article <db16tr$1bnc$1 digitaldaemon.com>, Martin Desperate says...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...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.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.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
Jul 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...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...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.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.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
Jul 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...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...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.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.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
Jul 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
Jul 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 fromjustreading 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 justreturna value. I someone want's to write a strict code then this someonewouldn't mindto write some more letters (but not other way around). Or make it other way arond if you want. But it is VERY inportant thatthesearrays could be used both ways! In article <db18ip$1ddf$1 digitaldaemon.com>, Martin Desperate says...downloadedThank you for your answer. Yes I mean the 0.125, thank you, I didn't notice that now it can bestillfrom that place.Okay, so I don't plan to make any money off of D, but you do realize D's(orin 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 inputloweven 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 writeandquality 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(AndJava is also much slower than D. Using D 0.125 would be still better than to use other languages for know.thefor 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 thinkwith a key that is not already in the array. Previously, the key would be added to the array.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 arrayit.All my work depends on previous behavior. My business logic is based onto getAbout 1 year of work, and this is not only hobby, but I was also hopingstillsome commercial proffit from it.Okay, so I don't plan to make any money off of D, but you do realize D's(orin 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 inputfor a veryeven 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 it0.0125.long time.I hope you mean DMD 0.125 because I'm pretty sure no one has versionFrom http://www.digitalmars.com/d/changelog.html#new0125, http://ftp.digitalmars.com/dmd.125.zip jcc7
Jul 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.What would you like? Regards, Martin In article <db1aq5$1fa7$1 digitaldaemon.com>, Charles says...I dont like either behavior really ( old or new )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 fromjustreading 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 justreturna value. I someone want's to write a strict code then this someonewouldn't mindto write some more letters (but not other way around). Or make it other way arond if you want. But it is VERY inportant thatthesearrays could be used both ways! In article <db18ip$1ddf$1 digitaldaemon.com>, Martin Desperate says...downloadedThank you for your answer. Yes I mean the 0.125, thank you, I didn't notice that now it can bestillfrom that place.Okay, so I don't plan to make any money off of D, but you do realize D's(orin 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 inputloweven 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 writeandquality 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(AndJava is also much slower than D. Using D 0.125 would be still better than to use other languages for know.thefor 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 thinkwith a key that is not already in the array. Previously, the key would be added to the array.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 arrayit.All my work depends on previous behavior. My business logic is based onto getAbout 1 year of work, and this is not only hobby, but I was also hopingstillsome commercial proffit from it.Okay, so I don't plan to make any money off of D, but you do realize D's(orin 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 inputfor a veryeven 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 it0.0125.long time.I hope you mean DMD 0.125 because I'm pretty sure no one has versionFrom http://www.digitalmars.com/d/changelog.html#new0125, http://ftp.digitalmars.com/dmd.125.zip jcc7
Jul 12 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.
Jul 12 2005
Yes you are right,this yould have given me an error also before. In article <db1u3k$1um4$1 digitaldaemon.com>, Ben Hinkle says..."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.
Jul 14 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.
Jul 12 2005
Hasan Aljudy wrote:Maybe we should do the same for strings too, then ? And arrays ? etc... (i.e. add wrapper classes for the other D things that has problems too) IMHO, More indirection is hardly the way to solve basic issues with the D language, even if it is a nice way to abstract any advanced concepts. If the arrays and tables are to be built-in to the language, then they should be so smooth that you *don't* feel the need to do it yourself ? Otherwise, it would be better off not burdering the language with those concepts and implement them all in a library. Like in C++. Or in Java. --andersBut 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.
Jul 13 2005
The problem here is that D is in beta phase, so things are almost guaranteed to change. btw, in OOP we use wrappers for everything (hence the get() and set() methods all over the place). Anders F Björklund wrote:Hasan Aljudy wrote:Maybe we should do the same for strings too, then ? And arrays ? etc... (i.e. add wrapper classes for the other D things that has problems too) IMHO, More indirection is hardly the way to solve basic issues with the D language, even if it is a nice way to abstract any advanced concepts. If the arrays and tables are to be built-in to the language, then they should be so smooth that you *don't* feel the need to do it yourself ? Otherwise, it would be better off not burdering the language with those concepts and implement them all in a library. Like in C++. Or in Java. --andersBut 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.
Jul 13 2005
Hasan Aljudy wrote:The problem here is that D is in beta phase, so things are almost guaranteed to change.Since even the specification is changing, it's alpha stage (at most)btw, in OOP we use wrappers for everything (hence the get() and set() methods all over the place).D makes quite a point of *not* needing wrappers for strings and arrays and tables (AAs), very unlike how for instance C++ and Java does it... ? Also, in D we have "properties" so there are no names "get" and "set"; As detailed on http://www.digitalmars.com/d/cpptod.html#properties --anders
Jul 13 2005
Anders F Björklund wrote:Yeah, I wasn't talking about D, just the OOP paradigm. Also btw, properties are just sugar for get and set, I personally don't see much point to using them.btw, in OOP we use wrappers for everything (hence the get() and set() methods all over the place).D makes quite a point of *not* needing wrappers for strings and arrays and tables (AAs), very unlike how for instance C++ and Java does it... ? Also, in D we have "properties" so there are no names "get" and "set"; As detailed on http://www.digitalmars.com/d/cpptod.html#properties --anders
Jul 13 2005
Hasan Aljudy wrote:[...]Also, in D we have "properties" so there are no names "get" and "set"; As detailed on http://www.digitalmars.com/d/cpptod.html#propertiesAlso btw, properties are just sugar for get and set, I personally don't see much point to using them.Actually I just meant the naming, as I'm normally using "overloading" in C++ too - while I do use the JavaBeans standard (get/set) in Java. I do think the "properties" are pretty sweet looking, though... --anders
Jul 14 2005
Actually it is not a bad idea. struct STRING_CHAR { char []s[char []]; char []opIndex(char []a){ if(a not in s)return ""; else return s[a]; } char [] opIndexAssign(char []what,char []a){ if(a not in s)s.addKey(a); s[a]=what; return what; } } void test() { STRING_CHAR a; STRING_CHAR b; char []i; i = a["yes"]; // same as i = a.opIndex(5,6,7); a["yes"] = "no"; // same as a.opIndexAssign(7,i,3); b["yes"]="yes"; b["yes"]=b["yes"]~"ok!"; printf(":%.*s %.*s \n",a["yes"],b["yes"]); } And could do templates so every type int [char[]], double [char[]] ... could be simply implemented. Thank you! In article <db1bev$1fvt$1 digitaldaemon.com>, Hasan Aljudy says...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.
Jul 14 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?
Jul 12 2005
Martin Desperate wrote:no comments :) ftp://ftp.digitalmars.com/dmd.125.zip I hope this will helpsAll 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.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.
Jul 13 2005
PHP throws a notice and generates an "Undefined index" or "Undefined offset" message if you try to read from an associative array where a key does not exist. Many people ignore such errors, but they actually represent a significant speed/efficiency hit. -[Unknown]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.
Jul 13 2005
Martin Desperate wrote:How did you find all the occurrences on your code? Antonio MonteiroAll 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.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.
Jul 28 2005