August 20, 2004 Re: DMD 0.99 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <newshound@digitalmars.com> wrote in message news:cg3sh1$2qr1$1@digitaldaemon.com... > > "Ben Hinkle" <bhinkle4@juno.com> wrote in message news:cg3oug$2ond$1@digitaldaemon.com... > > Walter wrote: > > > > > Lots more bug fixes. Added special 'length' inside array [ ]'s. > > > > > > http://www.digitalmars.com/d/changelog.html > > > > I don't suppose there's any way to get that sugar for things that > implement > > opIndex, opSlice, etc. Or that that work already? I'm thinking that if x > is > > an instance of class Foo and Foo defined opIndex and length() then > > x[length-1] is the same as x.opIndex(x.length-1). > > That does need to be done. I was thinking that an implicit 'with' statement could happen, and then all the members of the class instance would be usable. Yikes no. Please, in the words of the expository master: "do as the ints do" and the relativistic master: "as simple as possible, but no simpler". |
August 20, 2004 Re: DMD 0.99 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vathix | "Vathix" <vathixSpamFix@dprogramming.com> wrote in message news:cg3trp$2s1u$1@digitaldaemon.com... > > Added special 'length' inside array [ ]'s. > > > > I think it's pretty cool, but might cause logic bugs. I'm just glad I've been lazy in naming my variables len instead of length. Perhaps it should be illegal to name something length, and just allow classes/structs/unions to have an opLength() ? It would also be helpful for people porting from another language. length is a pretty popular name. At first I thought yuck. But mere seconds later, I think Yes! Please add me onto this soon-to-huge list of Yeah-sayers |
August 20, 2004 Re: DMD 0.99 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Walter wrote:
> Lots more bug fixes. Added special 'length' inside array [ ]'s.
>
> http://www.digitalmars.com/d/changelog.html
>
>
Walter, have you got std.loader compiled into phobos on linux?
|
August 20, 2004 Re: DMD 0.99 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to clayasaurus | "clayasaurus" <clayasaurus@gmail.com> wrote in message news:cg3vc7$2t8d$1@digitaldaemon.com... > Walter wrote: > > Lots more bug fixes. Added special 'length' inside array [ ]'s. > > > > http://www.digitalmars.com/d/changelog.html > > > > > > Walter, have you got std.loader compiled into phobos on linux? Good question. btw, I'm going to bite the bullet next week and revisit std.loader. I don't know whether I can resurrect it from its current ignominy, or whether a total reimplementation (keeping interface, of course, if at all poss) will be called for. I do know that it's had lots of complaints and that, even though it was born out of wedlock, I still need to take my responsibilities seriously. Colin the Code Cassanova |
August 20, 2004 Re: DMD 0.99 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | "Matthew" <admin.hat@stlsoft.dot.org> wrote in message news:cg3v1i$2t3r$1@digitaldaemon.com... > > "Walter" <newshound@digitalmars.com> wrote in message news:cg3sh1$2qr1$1@digitaldaemon.com... > > > > "Ben Hinkle" <bhinkle4@juno.com> wrote in message news:cg3oug$2ond$1@digitaldaemon.com... > > > Walter wrote: > > > > > > > Lots more bug fixes. Added special 'length' inside array [ ]'s. > > > > > > > > http://www.digitalmars.com/d/changelog.html > > > > > > I don't suppose there's any way to get that sugar for things that > > implement > > > opIndex, opSlice, etc. Or that that work already? I'm thinking that if x > > is > > > an instance of class Foo and Foo defined opIndex and length() then > > > x[length-1] is the same as x.opIndex(x.length-1). > > > > That does need to be done. I was thinking that an implicit 'with' statement > > could happen, and then all the members of the class instance would be usable. > > Yikes no. > > Please, in the words of the expository master: "do as the ints do" and the relativistic master: "as simple as possible, > but no simpler". How else to supply the length? Just make that member visible? |
August 20, 2004 Re: DMD 0.99 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | "Matthew" <admin.hat@stlsoft.dot.org> wrote in message news:cg3uu9$2t1b$1@digitaldaemon.com... > > "Ben Hinkle" <bhinkle4@juno.com> wrote in message news:cg3oug$2ond$1@digitaldaemon.com... > > Walter wrote: > > > > > Lots more bug fixes. Added special 'length' inside array [ ]'s. > > > > > > http://www.digitalmars.com/d/changelog.html > > > > I don't suppose there's any way to get that sugar for things that implement > > opIndex, opSlice, etc. Or that that work already? I'm thinking that if x is > > an instance of class Foo and Foo defined opIndex and length() then > > x[length-1] is the same as x.opIndex(x.length-1). > > I never considered that that was _not_ the case. Please say that is indeed how it works, big-W. > > If not, count this a loud vote for that consistency. :) Right now it only works for arrays. |
August 20, 2004 Re: DMD 0.99 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | "Matthew" <admin.hat@stlsoft.dot.org> wrote in message news:cg3v1j$2t3r$2@digitaldaemon.com... > > "Vathix" <vathixSpamFix@dprogramming.com> wrote in message news:cg3trp$2s1u$1@digitaldaemon.com... > > > Added special 'length' inside array [ ]'s. > > > > > > > I think it's pretty cool, but might cause logic bugs. I'm just glad I've been lazy in naming my variables len instead of length. Perhaps it should be > > illegal to name something length, and just allow classes/structs/unions to > > have an opLength() ? It would also be helpful for people porting from another language. length is a pretty popular name. > > At first I thought yuck. But mere seconds later, I think Yes! Most of the proposals involved things like using a special token like $, but I thought we're already using length, so why not just continue that direction? |
August 20, 2004 Re: DMD 0.99 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | "Matthew" <admin.hat@stlsoft.dot.org> wrote in message news:cg3usm$2t04$1@digitaldaemon.com... > >Added special 'length' inside array [ ]'s. > > Excellent. I really can't imagine this causing more than a very few faltering steps for each developer, and a > considerable, albiet sugary, syntactic simplification. > > Now, how do I go about raising the issue of D providing thread-agnostic implicit reg-exp, a la Perl and Ruby? > > (I'm not kidding!) 2.0. BTW, are you following Andrei A's thread on adding lock-free concurrent containers to C++? It's a great read in comp.lang.c++.moderated under the thread "Multithreaded programming: is the C++ standardization committee listening?" |
August 20, 2004 Re: DMD 0.99 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <newshound@digitalmars.com> wrote in message news:cg40as$2thv$1@digitaldaemon.com... > > "Matthew" <admin.hat@stlsoft.dot.org> wrote in message news:cg3v1i$2t3r$1@digitaldaemon.com... > > > > "Walter" <newshound@digitalmars.com> wrote in message > news:cg3sh1$2qr1$1@digitaldaemon.com... > > > > > > "Ben Hinkle" <bhinkle4@juno.com> wrote in message news:cg3oug$2ond$1@digitaldaemon.com... > > > > Walter wrote: > > > > > > > > > Lots more bug fixes. Added special 'length' inside array [ ]'s. > > > > > > > > > > http://www.digitalmars.com/d/changelog.html > > > > > > > > I don't suppose there's any way to get that sugar for things that > > > implement > > > > opIndex, opSlice, etc. Or that that work already? I'm thinking that if > x > > > is > > > > an instance of class Foo and Foo defined opIndex and length() then > > > > x[length-1] is the same as x.opIndex(x.length-1). > > > > > > That does need to be done. I was thinking that an implicit 'with' > statement > > > could happen, and then all the members of the class instance would be usable. > > > > Yikes no. > > > > Please, in the words of the expository master: "do as the ints do" and the > relativistic master: "as simple as possible, > > but no simpler". > > How else to supply the length? Just make that member visible? I like Chris' suggestion of opLength(), but if not I'd settle for the compiler making length a special case. Of course, if it's going to be a special case, then why not an operator. And if that's the case, then what about allowing the Python like syntax int l = length(x); // Equivalent to int l = x.length; I'm not proposing this last bit, mind, just interested in hearing opinions on the matter. |
August 20, 2004 Re: DMD 0.99 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <newshound@digitalmars.com> wrote in message news:cg40at$2thv$3@digitaldaemon.com... > > "Matthew" <admin.hat@stlsoft.dot.org> wrote in message news:cg3v1j$2t3r$2@digitaldaemon.com... > > > > "Vathix" <vathixSpamFix@dprogramming.com> wrote in message > news:cg3trp$2s1u$1@digitaldaemon.com... > > > > Added special 'length' inside array [ ]'s. > > > > > > > > > > I think it's pretty cool, but might cause logic bugs. I'm just glad I've been lazy in naming my variables len instead of length. Perhaps it > should be > > > illegal to name something length, and just allow classes/structs/unions > to > > > have an opLength() ? It would also be helpful for people porting from another language. length is a pretty popular name. > > > > At first I thought yuck. But mere seconds later, I think Yes! > > Most of the proposals involved things like using a special token like $, but I thought we're already using length, so why not just continue that direction? Oh sure, we agree on the syntax. Just that the special symbol for the length operator should be, er, "length". :-) |
Copyright © 1999-2021 by the D Language Foundation