digitalmars.D - DMD 0.116 release
- Walter (2/2) Mar 07 2005 I'm not too sure about $, __FILE__ or __LINE__. There might be a better ...
- Andrew Fedoniouk (15/19) Mar 07 2005 Walter, could you shed more light on this:
- Walter (5/16) Mar 07 2005 That's right, but it only applies to the code within std\string.d. The
- Matthew (13/35) Mar 07 2005 Not so. Yesterday I defined toString() for three enums in std.openrj,
- Andrew Fedoniouk (13/36) Mar 07 2005 Walter, beg my pardon but still unclear....
- Walter (17/18) Mar 07 2005 ------------ old way, doesn't work anymore ------------------
- Andrew Fedoniouk (9/28) Mar 07 2005 I see now. Thanks a lot, Walter, for comments.
- Walter (3/9) Mar 07 2005 Right. oops!
- Matthew (5/23) Mar 07 2005 That's at least a lot more sensible.
- Walter (6/39) Mar 07 2005 What happened was the old way was done before there were packages. I'd
- pragma (6/24) Mar 07 2005 Thank you for the clarification, Walter. I was scratching my head prett...
- Walter (3/5) Mar 07 2005 Yes, you could use an alias.
- John Demme (17/23) Mar 07 2005 Warnings? Whoa! Walter, I know you didn't like the idea of warnings, so...
- Andrew Fedoniouk (8/34) Mar 07 2005 Totally agree.
- Matthew (9/24) Mar 07 2005 Don't like it.
- John Demme (13/46) Mar 07 2005 OK... show me what it is. There are a few good symbols one could use:
- Matthew (22/69) Mar 07 2005 Well, I hate the _arguments stuff. Underscores are for
- Martin M. Pedersen (5/7) Mar 08 2005 And people coming from BASIC would think that it is a string :-)
- Matthew (18/21) Mar 07 2005 He he. I'm now inclining towards a more general approach to context
- John Demme (15/39) Mar 07 2005 I don't think that's the best definition, as I think that that's the
- Matthew (18/58) Mar 07 2005 That's why I put it in the quotes. I leave it to those more expert in
- xs0 (1/3) Mar 07 2005 Isn't the context of the innermost entity the default? :)
- Andrew Fedoniouk (10/32) Mar 07 2005 Hmmmm....
- zwang (2/16) Mar 07 2005 .length should refer to the length variable defined in the outer scope.
- Matthew (6/53) Mar 07 2005 1..length
- Andrew Fedoniouk (1/2) Mar 07 2005 Sure :)
- Nick Sabalausky (3/49) Mar 09 2005 Using "dot" like that is already the global scope resolution operator.
- Ben Hinkle (1/6) Mar 07 2005 you mean like what $EX would return? hmm...
- Norbert Nemec (5/41) Mar 08 2005 Nice idea, but any such general approach will not scale up to
- Kris (34/34) Mar 07 2005 Warning messages with Mango:
- clayasaurus (10/23) Mar 07 2005 humm... i'm not 100% but i think the reason it is not reachable is
- Kris (5/28) Mar 07 2005 It would only be dead-code if it were in a combined block with the other...
- Matthew (4/23) Mar 07 2005 Could be some hat-eating here ...
- Derek Parnell (41/70) Mar 07 2005 Maybe, but I'm starting to think that Walter's idea of unreachable code ...
- Walter (4/13) Mar 07 2005 return. I
- Derek Parnell (6/23) Mar 07 2005 Great! I just had about 50 of these to get around.
- Kris (4/20) Mar 07 2005 Thanks.
- David Medlock (4/8) Mar 07 2005 Why not just make with() apply to arrays as well?
- John Demme (3/17) Mar 07 2005 Ewwie... Confusing... the first time I looked at that I thought, "but
- Matthew (1/4) Mar 07 2005 What about where you've got more than array involved in the statement?
- David Medlock (3/14) Mar 07 2005 with(a) x[0..length] = a[0..length];
- Matthew (5/20) Mar 07 2005 Sorry, my mistake.
- David Medlock (5/35) Mar 07 2005 With broadens a search for scoped variables. So when the compiler tries
- U.Baumanis (4/6) Mar 08 2005 I like $. Code looks very readable to me. :-)
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (14/19) Mar 08 2005 Good for writing gnomish programs:
- Regan Heath (14/16) Mar 08 2005 char[] function() {...}
- =?ISO-8859-15?Q?Anders_F_Bj=F6rklund?= (5/15) Mar 08 2005 So just use a temp ? Compiler has to, anyway.
- Regan Heath (13/25) Mar 08 2005 That's what I did, in my example:
- =?ISO-8859-15?Q?Anders_F_Bj=F6rklund?= (11/35) Mar 08 2005 No, I meant:
- Regan Heath (6/29) Mar 08 2005 Oh, sorry. I see.
- U.Baumanis (3/14) Mar 08 2005 I like your comment, but cannot help. :-)
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (9/12) Mar 08 2005 That's OK, it's just that GDC is at
- Stewart Gordon (22/25) Mar 08 2005 "warning - array 'length' hides other 'length' name in outer scope"
- Carlos Santander B. (15/15) Mar 08 2005 I think this is a bug:
- Jarrett Billingsley (2/3) Mar 08 2005 Oh, Christ Almighty. Coming from a basic background, this is going to l...
- John Reimer (2/9) Mar 08 2005 He is indeed. Please don't resort to profanity.
- Matthew (5/9) Mar 08 2005 We've decided to placate Believers, Agnostics and Atheists on this ng by...
- Brad Anderson (2/17) Mar 08 2005 Bobdamnit!
- Jarrett Billingsley (1/4) Mar 09 2005 Oh, Bob Almighty then.
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (9/17) Mar 08 2005 http://www.digitalmars.com/drn-bin/wwwnews?D.gnu/983
I'm not too sure about $, __FILE__ or __LINE__. There might be a better way. http://www.digitalmars.com/d/changelog.html
Mar 07 2005
Walter, could you shed more light on this: <cite> If a module statement name is used with a package prefix, as in: import foo.bar; then bar is not in scope, one must use foo.bar. </cite> ??? Is this mean that if import std.string; then one must use fully qualified std.string.memcpy name? Thanks in advance, Andrew. "Walter" <newshound digitalmars.com> wrote in message news:d0irlm$o0s$1 digitaldaemon.com...I'm not too sure about $, __FILE__ or __LINE__. There might be a better way. http://www.digitalmars.com/d/changelog.html
Mar 07 2005
"Andrew Fedoniouk" <news terrainformatica.com> wrote in message news:d0is5v$ofv$1 digitaldaemon.com...Walter, could you shed more light on this: <cite> If a module statement name is used with a package prefix, as in: import foo.bar; then bar is not in scope, one must use foo.bar. </cite> ??? Is this mean that if import std.string; then one must use fully qualified std.string.memcpy name?That's right, but it only applies to the code within std\string.d. The circumstance happens rarely that one would qualify a name within the module itself.
Mar 07 2005
"Walter" <newshound digitalmars.com> wrote in message news:d0isrh$p4t$1 digitaldaemon.com..."Andrew Fedoniouk" <news terrainformatica.com> wrote in message news:d0is5v$ofv$1 digitaldaemon.com...Not so. Yesterday I defined toString() for three enums in std.openrj, and then needed to qualify each and every use with std.openrj because they were inside the DatabaseException class. This is intensely irritating (though I do not claim it as significant for that reason). On this point - i.e. the notion of generalised/attribute-based coding, shims, etc. - I think it's a serious mistake to have instance methods have the same name as the shims, i.e. X.toString(), toString(int). It reduces the scope for generalised programming markedly. I had started to do distinct shims in DTL, i.e. to_string(), and will likely pursue this, despite its probable confusion factor, as I don't see any alternative. Shims are way too powerful to give away ....Walter, could you shed more light on this: <cite> If a module statement name is used with a package prefix, as in: import foo.bar; then bar is not in scope, one must use foo.bar. </cite> ??? Is this mean that if import std.string; then one must use fully qualified std.string.memcpy name?That's right, but it only applies to the code within std\string.d. The circumstance happens rarely that one would qualify a name within the module itself.
Mar 07 2005
Walter, beg my pardon but still unclear.... <cite> If a module statement name is used with a package prefix, as in: import foo.bar; </cite> Shall it be If a module statement name is used with a package prefix, as in: module foo.bar; instead? Thanks, Andrew. "Walter" <newshound digitalmars.com> wrote in message news:d0isrh$p4t$1 digitaldaemon.com..."Andrew Fedoniouk" <news terrainformatica.com> wrote in message news:d0is5v$ofv$1 digitaldaemon.com...Walter, could you shed more light on this: <cite> If a module statement name is used with a package prefix, as in: import foo.bar; then bar is not in scope, one must use foo.bar. </cite> ??? Is this mean that if import std.string; then one must use fully qualified std.string.memcpy name?That's right, but it only applies to the code within std\string.d. The circumstance happens rarely that one would qualify a name within the module itself.
Mar 07 2005
"Andrew Fedoniouk" <news terrainformatica.com> wrote in message news:d0itsj$q7v$1 digitaldaemon.com...Walter, beg my pardon but still unclear....------------ old way, doesn't work anymore ------------------ module foo.bar; void test() { } void func() { bar.test(); } ------------- new way ------------------ module foo.bar; void test() { } void func() { foo.bar.test(); } ------------------------------------------
Mar 07 2005
I see now. Thanks a lot, Walter, for comments. Could you change then import foo.bar; to module foo.bar; here http://www.digitalmars.com/d/changelog.html#new0116 ? Andrew. "Walter" <newshound digitalmars.com> wrote in message news:d0iuk9$r4j$1 digitaldaemon.com..."Andrew Fedoniouk" <news terrainformatica.com> wrote in message news:d0itsj$q7v$1 digitaldaemon.com...Walter, beg my pardon but still unclear....------------ old way, doesn't work anymore ------------------ module foo.bar; void test() { } void func() { bar.test(); } ------------- new way ------------------ module foo.bar; void test() { } void func() { foo.bar.test(); } ------------------------------------------
Mar 07 2005
"Andrew Fedoniouk" <news terrainformatica.com> wrote in message news:d0iur7$rf4$1 digitaldaemon.com...I see now. Thanks a lot, Walter, for comments. Could you change then import foo.bar; to module foo.bar; here http://www.digitalmars.com/d/changelog.html#new0116 ?Right. oops!
Mar 07 2005
"Walter" <newshound digitalmars.com> wrote in message news:d0iuk9$r4j$1 digitaldaemon.com..."Andrew Fedoniouk" <news terrainformatica.com> wrote in message news:d0itsj$q7v$1 digitaldaemon.com...That's at least a lot more sensible. Tell me, the rusty old twit, can alias work to disambiguate same-named functions from multiple modules?Walter, beg my pardon but still unclear....------------ old way, doesn't work anymore ------------------ module foo.bar; void test() { } void func() { bar.test(); } ------------- new way ------------------ module foo.bar; void test() { } void func() { foo.bar.test(); } ------------------------------------------
Mar 07 2005
"Matthew" <admin stlsoft.dot.dot.dot.dot.org> wrote in message news:d0iv6b$rp8$1 digitaldaemon.com..."Walter" <newshound digitalmars.com> wrote in message news:d0iuk9$r4j$1 digitaldaemon.com...What happened was the old way was done before there were packages. I'd overlooked it until now."Andrew Fedoniouk" <news terrainformatica.com> wrote in message news:d0itsj$q7v$1 digitaldaemon.com...That's at least a lot more sensible.Walter, beg my pardon but still unclear....------------ old way, doesn't work anymore ------------------ module foo.bar; void test() { } void func() { bar.test(); } ------------- new way ------------------ module foo.bar; void test() { } void func() { foo.bar.test(); } ------------------------------------------Tell me, the rusty old twit, can alias work to disambiguate same-named functions from multiple modules?Why not just put the module name in front of it to disambiguate them? That's how it's supposed to work.
Mar 07 2005
In article <d0iuk9$r4j$1 digitaldaemon.com>, Walter says..."Andrew Fedoniouk" <news terrainformatica.com> wrote in message news:d0itsj$q7v$1 digitaldaemon.com...Thank you for the clarification, Walter. I was scratching my head pretty hard from your description in the change log. So I gather that we're supposed to use aliases to get the old behavior, if that's what we want? - EricAnderton at yahooWalter, beg my pardon but still unclear....------------ old way, doesn't work anymore ------------------ module foo.bar; void test() { } void func() { bar.test(); } ------------- new way ------------------ module foo.bar; void test() { } void func() { foo.bar.test(); } ------------------------------------------
Mar 07 2005
"pragma" <pragma_member pathlink.com> wrote in message news:d0ivr5$sh5$1 digitaldaemon.com...So I gather that we're supposed to use aliases to get the old behavior, if that's what we want?Yes, you could use an alias.
Mar 07 2005
Warnings? Whoa! Walter, I know you didn't like the idea of warnings, so thanks for at least giving it a try. I'm sure we'll let you know what we think. Let me preface myself by saying that I haven't been following the $ or __FILE__ discussion (we've got waaay too much going on on this NG nowadays) so I aplogize if I'm stepping on anyone's toes. As for $, __FILE__, and __LINE__... a meta-keyword... Then we replace length with $length, __FILE__ with $file, ect... All other valid identifiers prefixed with $ should be illegal... This way, when one wants to add features such as these, it will not break existing code, and will not necessitate additional keywords. Perhaps there are even more uses for these "meta-keywords" as well. Thoughts? John Demme Walter wrote:I'm not too sure about $, __FILE__ or __LINE__. There might be a better way. http://www.digitalmars.com/d/changelog.html
Mar 07 2005
All other valid identifiers prefixed with $ should beillegal... This way, when one wants to add features such as these, it will not break existing code, and will not necessitate additional keywords. Perhaps there are even more uses for these "meta-keywords" as well.Totally agree. More candidates on this: _arguments ->$arguments _argptr -> $argptr Andrew. "John Demme" <me teqdruid.com> wrote in message news:d0itb3$pid$1 digitaldaemon.com...Warnings? Whoa! Walter, I know you didn't like the idea of warnings, so thanks for at least giving it a try. I'm sure we'll let you know what we think. Let me preface myself by saying that I haven't been following the $ or __FILE__ discussion (we've got waaay too much going on on this NG nowadays) so I aplogize if I'm stepping on anyone's toes. As for $, __FILE__, and __LINE__... meta-keyword... Then we replace length with $length, __FILE__ with $file, ect... All other valid identifiers prefixed with $ should be illegal... This way, when one wants to add features such as these, it will not break existing code, and will not necessitate additional keywords. Perhaps there are even more uses for these "meta-keywords" as well. Thoughts? John Demme Walter wrote:I'm not too sure about $, __FILE__ or __LINE__. There might be a better way. http://www.digitalmars.com/d/changelog.html
Mar 07 2005
"John Demme" <me teqdruid.com> wrote in message news:d0itb3$pid$1 digitaldaemon.com...Warnings? Whoa! Walter, I know you didn't like the idea of warnings, so thanks for at least giving it a try. I'm sure we'll let you know what we think. Let me preface myself by saying that I haven't been following the $ or __FILE__ discussion (we've got waaay too much going on on this NG nowadays) so I aplogize if I'm stepping on anyone's toes. As for $, __FILE__, and __LINE__... identifier> a meta-keyword... Then we replace length with $length, __FILE__ with $file, ect... All other valid identifiers prefixed with $ should be illegal... This way, when one wants to add features such as these, it will not break existing code, and will not necessitate additional keywords. Perhaps there are even more uses for these "meta-keywords" as well. Thoughts?Don't like it. First: $ as a prefix may be getting a far more important and central role in the language. Second: __FILE__ and __LINE__ are damn ugly, and that's a good thing. Making them less so might incline people to over/ab-use Third: __FILE__ and __LINE__ are standard parts of other languages, and widely recognised by most/all programmers.
Mar 07 2005
Matthew wrote:"John Demme" <me teqdruid.com> wrote in message news:d0itb3$pid$1 digitaldaemon.com...OK... show me what it is. There are a few good symbols one could use: Also, $arguments, and $argptr, are good for this. I'm sure they'll be more that might be appropriate. I (obviously) like the idea of being able to add small features to the language without breaking code. This means that we'd be able to get convient features between 1.0 and 2.0.Warnings? Whoa! Walter, I know you didn't like the idea of warnings, so thanks for at least giving it a try. I'm sure we'll let you know what we think. Let me preface myself by saying that I haven't been following the $ or __FILE__ discussion (we've got waaay too much going on on this NG nowadays) so I aplogize if I'm stepping on anyone's toes. As for $, __FILE__, and __LINE__... identifier> a meta-keyword... Then we replace length with $length, __FILE__ with $file, ect... All other valid identifiers prefixed with $ should be illegal... This way, when one wants to add features such as these, it will not break existing code, and will not necessitate additional keywords. Perhaps there are even more uses for these "meta-keywords" as well. Thoughts?Don't like it. First: $ as a prefix may be getting a far more important and central role in the language.Second: __FILE__ and __LINE__ are damn ugly, and that's a good thing. Making them less so might incline people to over/ab-use Third: __FILE__ and __LINE__ are standard parts of other languages, and widely recognised by most/all programmers.OK... how about $__FILE__ and $__LINE__? they're ugly now :) Seriously, I don't buy it. If a programmer's going to abuse something, then it going to be abused. If a programmer don't know what abuse is, I'm not certain (s)he's gonna know what code beauty is either. But maybe I'm outta my gourd. John
Mar 07 2005
"John Demme" <me teqdruid.com> wrote in message news:d0iujc$r3o$1 digitaldaemon.com...Matthew wrote:Well, I hate the _arguments stuff. Underscores are for - compiler extensions. This is expressely against the D philosphy, and DMD should never have them - irrepairable mistakes. D shouldn't have any of these prior to 1.0. (Although it's trying ...) I don't know whether they can be made to fit the $xyz model, but my gut says they can (and should)"John Demme" <me teqdruid.com> wrote in message news:d0itb3$pid$1 digitaldaemon.com...OK... show me what it is. There are a few good symbols one could use: do. Also, $arguments, and $argptr, are good for this. I'm sure they'll be more that might be appropriate. I (obviously) like the idea of being able to add small features to the language without breaking code. This means that we'd be able to get convient features between 1.0 and 2.0.Warnings? Whoa! Walter, I know you didn't like the idea of warnings, so thanks for at least giving it a try. I'm sure we'll let you know what we think. Let me preface myself by saying that I haven't been following the $ or __FILE__ discussion (we've got waaay too much going on on this NG nowadays) so I aplogize if I'm stepping on anyone's toes. As for $, __FILE__, and __LINE__... identifier> a meta-keyword... Then we replace length with $length, __FILE__ with $file, ect... All other valid identifiers prefixed with $ should be illegal... This way, when one wants to add features such as these, it will not break existing code, and will not necessitate additional keywords. Perhaps there are even more uses for these "meta-keywords" as well. Thoughts?Don't like it. First: $ as a prefix may be getting a far more important and central role in the language.Well, there's no distinguishment between things that are part of the language proper, and things which are more compile-time 'facilities'. $length, assuming that particular syntax is the goer, would be a regularly used facility. It's 'normal' code. __DATE__, on the other hand, is a symbol that the compiler generates on our behalf, and would not anything but 'normal'. Nor would it manipulable. It's a context-dependent constant, I guess. The two things are different, IMO, and should be represented as such. In any case, you've not addressed the consistency issue. Even syntactically 'weird' languages such as Ruby still use __FILE__. (Python uses __file__, but then source files are an 'active' part of Python, whereas in C/C++/D/Java/.NET they are the stuff that happens before the code becomes code.)Second: __FILE__ and __LINE__ are damn ugly, and that's a good thing. Making them less so might incline people to over/ab-use Third: __FILE__ and __LINE__ are standard parts of other languages, and widely recognised by most/all programmers.OK... how about $__FILE__ and $__LINE__? they're ugly now :) Seriously, I don't buy it. If a programmer's going to abuse something, then it going to be abused. If a programmer don't know what abuse is, I'm not certain (s)he's gonna know what code beauty is either. But maybe I'm outta my gourd.
Mar 07 2005
"Matthew" <admin stlsoft.dot.dot.dot.dot.org> skrev i en meddelelse news:d0iv6c$rp8$2 digitaldaemon.com...$length, assuming that particular syntax is the goer, would be a regularly used facility. It's 'normal' code.And people coming from BASIC would think that it is a string :-) Regards, Martin
Mar 08 2005
"Walter" <newshound digitalmars.com> wrote in message news:d0irlm$o0s$1 digitaldaemon.com...I'm not too sure about $, __FILE__ or __LINE__. There might be a better way. http://www.digitalmars.com/d/changelog.htmlHe he. I'm now inclining towards a more general approach to context dependency, following the $length, $count, etc. mentioned (by ??forgotten??; sorry) the other day. Simply put, $ would mean 'within the context of the innermost entity', so: int[] a = . . . if( 0 != a.length && a[$length - 1] == 10) { ... Thus $ is not 'wasted' on array length, and neither $len nor $length (nor anything else) are defined as some special funky kinds of keywords. Rather, $X means that X is relative. Like a deeper/funkier with. I'll leave it to faster/sharper minds to come up with all the wild ramifications of this ... :-)
Mar 07 2005
Matthew wrote:"Walter" <newshound digitalmars.com> wrote in message news:d0irlm$o0s$1 digitaldaemon.com...I don't think that's the best definition, as I think that that's the default. The way I read it, these are equivalent: array[4..length]; and array[4..$length]; It doesn't say anything about certain identifiers only existing after a $.I'm not too sure about $, __FILE__ or __LINE__. There might be a better way. http://www.digitalmars.com/d/changelog.htmlHe he. I'm now inclining towards a more general approach to context dependency, following the $length, $count, etc. mentioned (by ??forgotten??; sorry) the other day. Simply put, $ would mean 'within the context of the innermost entity', so:int[] a = . . . if( 0 != a.length && a[$length - 1] == 10) { ...Looking at the example, it seems to me what you want is that $<identifier> is an alias for the property of the last variable in the chain. Example: a.b.c($something); the $something returns c.something if it exists, then b.something if it exists, then a.something if it exists, or doesn't compile... or am I looking too far into this? John Demme
Mar 07 2005
"John Demme" <me teqdruid.com> wrote in message news:d0iu6v$qk7$1 digitaldaemon.com...Matthew wrote:That's why I put it in the quotes. I leave it to those more expert in programming linguistics to define the term. They'll be along shortly, you can be sure ..."Walter" <newshound digitalmars.com> wrote in message news:d0irlm$o0s$1 digitaldaemon.com...I don't think that's the best definition,I'm not too sure about $, __FILE__ or __LINE__. There might be a better way. http://www.digitalmars.com/d/changelog.htmlHe he. I'm now inclining towards a more general approach to context dependency, following the $length, $count, etc. mentioned (by ??forgotten??; sorry) the other day. Simply put, $ would mean 'within the context of the innermost entity', so:as I think that that's the default. The way I read it, these are equivalent: array[4..length]; and array[4..$length]; It doesn't say anything about certain identifiers only existing after a $.No. I mean we dispense with the evil first form, and require anyone not wanting to write array[4 .. array.length] to write array[4 .. $length]No, you're not. I'm hoping very much all you smart cookies will look deeply into this idea, and solve all the riddles I've not even bothered to think about yet. :-) I don't know if the definition would be 'last variable in the chain'; that's why I said 'within the context of the innermost entity'. If others could chime in with different use cases, i.e. things other than array length, then I think we might be able to come up with something rather groovy.int[] a = . . . if( 0 != a.length && a[$length - 1] == 10) { ...Looking at the example, it seems to me what you want is that $<identifier> is an alias for the property of the last variable in the chain. Example: a.b.c($something); the $something returns c.something if it exists, then b.something if it exists, then a.something if it exists, or doesn't compile... or am I looking too far into this?
Mar 07 2005
Simply put, $ would mean 'within the context of the innermost entity', so:Isn't the context of the innermost entity the default? :)
Mar 07 2005
Hmmmm.... Can we just use "dot" for that? if( 0 != a.length && a[ .length - 1] == 10) [] brackets establish context (pretty much as 'with') a[.length-1] or a[.last] means as you said length of innermost array .arguments[] vector may also work. "Matthew" <admin stlsoft.dot.dot.dot.dot.org> wrote in message news:d0itm4$q26$1 digitaldaemon.com..."Walter" <newshound digitalmars.com> wrote in message news:d0irlm$o0s$1 digitaldaemon.com...I'm not too sure about $, __FILE__ or __LINE__. There might be a better way. http://www.digitalmars.com/d/changelog.htmlHe he. I'm now inclining towards a more general approach to context dependency, following the $length, $count, etc. mentioned (by ??forgotten??; sorry) the other day. Simply put, $ would mean 'within the context of the innermost entity', so: int[] a = . . . if( 0 != a.length && a[$length - 1] == 10) { ... Thus $ is not 'wasted' on array length, and neither $len nor $length (nor anything else) are defined as some special funky kinds of keywords. Rather, $X means that X is relative. Like a deeper/funkier with. I'll leave it to faster/sharper minds to come up with all the wild ramifications of this ... :-)
Mar 07 2005
Andrew Fedoniouk wrote:Hmmmm.... Can we just use "dot" for that? if( 0 != a.length && a[ .length - 1] == 10) [] brackets establish context (pretty much as 'with') a[.length-1] or a[.last] means as you said length of innermost array .arguments[] vector may also work..length should refer to the length variable defined in the outer scope.
Mar 07 2005
1..length Is that a range between 1 and a variable length, or between 1. and .length? I suspect the latter won't compile, but I'm sure you get the point "Andrew Fedoniouk" <news terrainformatica.com> wrote in message news:d0iuko$r4p$1 digitaldaemon.com...Hmmmm.... Can we just use "dot" for that? if( 0 != a.length && a[ .length - 1] == 10) [] brackets establish context (pretty much as 'with') a[.length-1] or a[.last] means as you said length of innermost array .arguments[] vector may also work. "Matthew" <admin stlsoft.dot.dot.dot.dot.org> wrote in message news:d0itm4$q26$1 digitaldaemon.com..."Walter" <newshound digitalmars.com> wrote in message news:d0irlm$o0s$1 digitaldaemon.com...I'm not too sure about $, __FILE__ or __LINE__. There might be a better way. http://www.digitalmars.com/d/changelog.htmlHe he. I'm now inclining towards a more general approach to context dependency, following the $length, $count, etc. mentioned (by ??forgotten??; sorry) the other day. Simply put, $ would mean 'within the context of the innermost entity', so: int[] a = . . . if( 0 != a.length && a[$length - 1] == 10) { ... Thus $ is not 'wasted' on array length, and neither $len nor $length (nor anything else) are defined as some special funky kinds of keywords. Rather, $X means that X is relative. Like a deeper/funkier with. I'll leave it to faster/sharper minds to come up with all the wild ramifications of this ... :-)
Mar 07 2005
I suspect the latter won't compile, but I'm sure you get the pointSure :)
Mar 07 2005
"Andrew Fedoniouk" <news terrainformatica.com> wrote in message news:d0iuko$r4p$1 digitaldaemon.com...Hmmmm.... Can we just use "dot" for that? if( 0 != a.length && a[ .length - 1] == 10) [] brackets establish context (pretty much as 'with') a[.length-1] or a[.last] means as you said length of innermost array .arguments[] vector may also work.Using "dot" like that is already the global scope resolution operator."Matthew" <admin stlsoft.dot.dot.dot.dot.org> wrote in message news:d0itm4$q26$1 digitaldaemon.com..."Walter" <newshound digitalmars.com> wrote in message news:d0irlm$o0s$1 digitaldaemon.com...I'm not too sure about $, __FILE__ or __LINE__. There might be a better way. http://www.digitalmars.com/d/changelog.htmlHe he. I'm now inclining towards a more general approach to context dependency, following the $length, $count, etc. mentioned (by ??forgotten??; sorry) the other day. Simply put, $ would mean 'within the context of the innermost entity', so: int[] a = . . . if( 0 != a.length && a[$length - 1] == 10) { ... Thus $ is not 'wasted' on array length, and neither $len nor $length (nor anything else) are defined as some special funky kinds of keywords. Rather, $X means that X is relative. Like a deeper/funkier with. I'll leave it to faster/sharper minds to come up with all the wild ramifications of this ... :-)
Mar 09 2005
Thus $ is not 'wasted' on array length, and neither $len nor $length (nor anything else) are defined as some special funky kinds of keywords. Rather, $X means that X is relative. Like a deeper/funkier with. I'll leave it to faster/sharper minds to come up with all the wild ramifications of this ...you mean like what $EX would return? hmm...
Mar 07 2005
Nice idea, but any such general approach will not scale up to multidimensional arrays. A $ or a keyword can always be given the meaning "length of the appropriate dimension". It will be hard to capture this with any general "with"-like approach. Matthew schrieb:"Walter" <newshound digitalmars.com> wrote in message news:d0irlm$o0s$1 digitaldaemon.com...I'm not too sure about $, __FILE__ or __LINE__. There might be a better way. http://www.digitalmars.com/d/changelog.htmlHe he. I'm now inclining towards a more general approach to context dependency, following the $length, $count, etc. mentioned (by ??forgotten??; sorry) the other day. Simply put, $ would mean 'within the context of the innermost entity', so: int[] a = . . . if( 0 != a.length && a[$length - 1] == 10) { ... Thus $ is not 'wasted' on array length, and neither $len nor $length (nor anything else) are defined as some special funky kinds of keywords. Rather, $X means that X is relative. Like a deeper/funkier with. I'll leave it to faster/sharper minds to come up with all the wild ramifications of this ... :-)
Mar 08 2005
Warning messages with Mango: the above produces a "statement not reachable" message for the null return. I think you'd agree that the statement most certainly should be reachable? The warning "implicit conversion of type long to int can cause loss of data" caught a Mango v1.2 change when formatting a cookie-age ~ it should have stated Long.format(tmp, maxAge) instead. I borked that when updating from a generic xtoi() routine that accepted a long. Thank goodness for warnings! Another bogus "statement is unreachable" message. Variable 'i' is an int, so it can be less than zero. Yet another. The unreachable-code warning seems to be broken? And another. I have to keep commenting-out code to get the compiler to move on, and I know this unreachable-code thing is gonna' produce a lot more messages (at this rate). Can you fix this please, and then I'll continue? Thanks;
Mar 07 2005
Kris wrote:Warning messages with Mango: the above produces a "statement not reachable" message for the null return. I think you'd agree that the statement most certainly should be reachable?humm... i'm not 100% but i think the reason it is not reachable is because if the 'if statement' is true then the 'return null' will be the 'dead code' simple fix would be... if (name in dictionary) return dictionary[name]; else return null; unless i'm just not understanding your point... :-/
Mar 07 2005
In article <d0j5nd$13fd$1 digitaldaemon.com>, clayasaurus says...Kris wrote:It would only be dead-code if it were in a combined block with the other return (would be vaguely amusing if the 'else' actually did make a difference :-) Nay ~ I think it's just a case of a bug in the message-production instead. There's plenty other false-positives to back that assertion.Warning messages with Mango: the above produces a "statement not reachable" message for the null return. I think you'd agree that the statement most certainly should be reachable?humm... i'm not 100% but i think the reason it is not reachable is because if the 'if statement' is true then the 'return null' will be the 'dead code' simple fix would be... if (name in dictionary) return dictionary[name]; else return null; unless i'm just not understanding your point... :-/
Mar 07 2005
"Kris" <Kris_member pathlink.com> wrote in message news:d0j2gi$vfp$1 digitaldaemon.com...Warning messages with Mango: the above produces a "statement not reachable" message for the null return. I think you'd agree that the statement most certainly should be reachable?Could be some hat-eating here ...The warning "implicit conversion of type long to int can cause loss of data" caught a Mango v1.2 change when formatting a cookie-age ~ it should have stated Long.format(tmp, maxAge) instead. I borked that when updating from a generic xtoi() routine that accepted a long. Thank goodness for warnings!:-)
Mar 07 2005
On Tue, 8 Mar 2005 14:07:25 +1100, Matthew wrote:"Kris" <Kris_member pathlink.com> wrote in message news:d0j2gi$vfp$1 digitaldaemon.com...Maybe, but I'm starting to think that Walter's idea of unreachable code is a lot different than mine. I'm getting a lot of this type of thing ... void search() { char[] [] lFiles; FileDateTime lCurFileTime; bool lCanUse; int lTextPos = 0; if(mHasBeenSearched) { return; } if(mVerboseMode) { //<<<<<<<< UNREACHABLE? I don't think so! writefln("Scanning %s", mFileName); } [snipped a whole mess of code] mHasBeenSearched = true; }Warning messages with Mango: the above produces a "statement not reachable" message for the null return. I think you'd agree that the statement most certainly should be reachable?Could be some hat-eating here ...This caught a mistake by me too. I had ... int x = atoi(text); Silly me thinking that 'atoi' meant ASCII text to int. It actually returns a long! Another time I had to change ... bool IsActive( char[] pID ) { return ( (pID in vActiveVersions) != null); } to this ... bool IsActive( char[] pID ) { return (pID in vActiveVersions) !== null ? true : false ; } which is actually better code. -- Derek Melbourne, Australia 8/03/2005 2:46:53 PMThe warning "implicit conversion of type long to int can cause loss of data" caught a Mango v1.2 change when formatting a cookie-age ~ it should have stated Long.format(tmp, maxAge) instead. I borked that when updating from a generic xtoi() routine that accepted a long. Thank goodness for warnings!:-)
Mar 07 2005
"Kris" <Kris_member pathlink.com> wrote in message news:d0j2gi$vfp$1 digitaldaemon.com...Warning messages with Mango: the above produces a "statement not reachable" message for the nullreturn. Ithink you'd agree that the statement most certainly should be reachable?Yes. That looks like a bug. I'll fix it.
Mar 07 2005
On Mon, 7 Mar 2005 19:49:56 -0800, Walter wrote:"Kris" <Kris_member pathlink.com> wrote in message news:d0j2gi$vfp$1 digitaldaemon.com...Great! I just had about 50 of these to get around. -- Derek Melbourne, Australia 8/03/2005 3:09:33 PMWarning messages with Mango: the above produces a "statement not reachable" message for the nullreturn. Ithink you'd agree that the statement most certainly should be reachable?Yes. That looks like a bug. I'll fix it.
Mar 07 2005
Thanks. Right now, the compiler halts after emiting a few warnings ... can you perhaps make it continue until it hits some errors (or runs out of files), please? In article <d0j7qe$15t6$1 digitaldaemon.com>, Walter says..."Kris" <Kris_member pathlink.com> wrote in message news:d0j2gi$vfp$1 digitaldaemon.com...Warning messages with Mango: the above produces a "statement not reachable" message for the nullreturn. Ithink you'd agree that the statement most certainly should be reachable?Yes. That looks like a bug. I'll fix it.
Mar 07 2005
Walter wrote:I'm not too sure about $, __FILE__ or __LINE__. There might be a better way. http://www.digitalmars.com/d/changelog.htmlWhy not just make with() apply to arrays as well? Cleaner, imo. with(a) x[0..length] = a[0..length];
Mar 07 2005
David Medlock wrote:Walter wrote:Ewwie... Confusing... the first time I looked at that I thought, "but what if x and a are different sizes?" Then I re-read it.I'm not too sure about $, __FILE__ or __LINE__. There might be a better way. http://www.digitalmars.com/d/changelog.htmlWhy not just make with() apply to arrays as well? Cleaner, imo. with(a) x[0..length] = a[0..length];
Mar 07 2005
Why not just make with() apply to arrays as well? Cleaner, imo. with(a) x[0..length] = a[0..length];What about where you've got more than array involved in the statement?
Mar 07 2005
Matthew wrote:with(a) x[0..length] = a[0..length]; ^^^^^^^Why not just make with() apply to arrays as well? Cleaner, imo. with(a) x[0..length] = a[0..length];What about where you've got more than array involved in the statement?
Mar 07 2005
"David Medlock" <amedlock nospam.com> wrote in message news:d0j92e$1706$1 digitaldaemon.com...Matthew wrote:Sorry, my mistake. So what does the above code do? It'd confuse the shit out of me even were it legal.with(a) x[0..length] = a[0..length]; ^^^^^^^Why not just make with() apply to arrays as well? Cleaner, imo. with(a) x[0..length] = a[0..length];What about where you've got more than array involved in the statement?
Mar 07 2005
Matthew wrote:"David Medlock" <amedlock nospam.com> wrote in message news:d0j92e$1706$1 digitaldaemon.com...With broadens a search for scoped variables. So when the compiler tries to figure out what length is, it checks with block, then local scope, etc. Its standard in pascal, although I dont know why walter only allows one item in there. Its a nice timesaver and underrated, imo.Matthew wrote:Sorry, my mistake. So what does the above code do? It'd confuse the shit out of me even were it legal.with(a) x[0..length] = a[0..length]; ^^^^^^^Why not just make with() apply to arrays as well? Cleaner, imo. with(a) x[0..length] = a[0..length];What about where you've got more than array involved in the statement?
Mar 07 2005
In article <d0irlm$o0s$1 digitaldaemon.com>, Walter says...I'm not too sure about $, __FILE__ or __LINE__. There might be a better way. http://www.digitalmars.com/d/changelog.htmlI like $. Code looks very readable to me. :-) Thanks! Ugis
Mar 08 2005
U.Baumanis wrote:Good for writing gnomish programs: char[][] phases; phases.length = 3; phases[0 .. 1] = "Collect underpants"; phases[1 .. 2]; phases[2 .. $] = "Profit!"; Totally readable, I agree. :-P But it does not work in GDC... And I *still* just don't see what was wrong with just using phases.length ? --anders PS. It's from Episode 217. http://www.tvtome.com/tvtome/servlet/GuidePageServlet/showid-344/epid-2446I'm not too sure about $, __FILE__ or __LINE__. There might be a better way. http://www.digitalmars.com/d/changelog.htmlI like $. Code looks very readable to me. :-)
Mar 08 2005
On Tue, 08 Mar 2005 10:03:55 +0100, Anders F Björklund <afb algonet.se> wrote:And I *still* just don't see what was wrong with just using phases.length ?char[] function() {...} function()[0..??] //how to express the length? really_long_and_complicated_expression_you_dont_want_to_evaluate_twice[0..really_long_and_complicated_expression_you_dont_want_to_ev luate_twice.length] //not so easy to read. It's really just syntactical sugar, except... void fn(inout char[] aa) {aa.length = aa.length + 1} int length; length = aa.length; if (fn(aa) && length == 5) {..} //length invalid at this point. (of course the soln is to replace length above with aa.length.. except if I also replace aa with one of the first two examples) Regan
Mar 08 2005
Regan Heath wrote:So just use a temp ? Compiler has to, anyway. Besides, you can also use [] instead of [0..$] ? Oh well. When GDC gets it, I'll think about it. --andersAnd I *still* just don't see what was wrong with just using phases.length ?char[] function() {...} function()[0..??] //how to express the length? really_long_and_complicated_expression_you_dont_want_to_evaluate_twice[0..really_long_and_complicated_expression_you_dont_want_to_ev luate_twice.length] //not so easy to read. It's really just syntactical sugar, except...
Mar 08 2005
On Tue, 08 Mar 2005 10:35:06 +0100, Anders F Björklund <afb algonet.se> wrote:Regan Heath wrote:That's what I did, in my example: void fn(inout char[] aa) {aa.length = aa.length + 1} int length; length = aa.length; if (fn(aa) && length == 5) {..} //length invalid at this point. using a temp could cause a nasty problem. Granted it's probably rare, but I think it would be very nasty.So just use a temp ?And I *still* just don't see what was wrong with just using phases.length ?char[] function() {...} function()[0..??] //how to express the length? really_long_and_complicated_expression_you_dont_want_to_evaluate_twice[0..really_long_and_complicated_expression_you_dont_want_to_ev luate_twice.length] //not so easy to read. It's really just syntactical sugar, except...Compiler has to, anyway.No, the compiler can access the 'length' method/member/value for the object in question.Besides, you can also use [] instead of [0..$] ?This is beside the point. Regan
Mar 08 2005
Regan Heath wrote:No, I meant: char[] temp = function(); temp = really_long_and_complicated_expression; temp[0..temp.length]; Like that.That's what I did, in my example:char[] function() {...} function()[0..??] //how to express the length? really_long_and_complicated_expression_you_dont_want_to_evaluate_twice[0..really_long_and_complicated_expression_you_dont_want_to_ev luate_twice.length] //not so easy to read. It's really just syntactical sugar, except...So just use a temp ?void fn(inout char[] aa) {aa.length = aa.length + 1} int length; length = aa.length; if (fn(aa) && length == 5) {..} //length invalid at this point. using a temp could cause a nasty problem. Granted it's probably rare, but I think it would be very nasty.Nastiest right now is that any "length" variable is sometimes hidden. But I meant a temp for the array reference, not the length. (see above)That was the temp I meant. (the object)Compiler has to, anyway.No, the compiler can access the 'length' method/member/value for the object in question.It was. --andersBesides, you can also use [] instead of [0..$] ?This is beside the point.
Mar 08 2005
On Tue, 08 Mar 2005 10:44:08 +0100, Anders F Björklund <afb algonet.se> wrote:Regan Heath wrote:Oh, sorry. I see.No, I meant: char[] temp = function(); temp = really_long_and_complicated_expression; temp[0..temp.length]; Like that.That's what I did, in my example:char[] function() {...} function()[0..??] //how to express the length? really_long_and_complicated_expression_you_dont_want_to_evaluate_twice[0..really_long_and_complicated_expression_you_dont_want_to_ev luate_twice.length] //not so easy to read. It's really just syntactical sugar, except...So just use a temp ?True, I was assuming that was removed.void fn(inout char[] aa) {aa.length = aa.length + 1} int length; length = aa.length; if (fn(aa) && length == 5) {..} //length invalid at this point. using a temp could cause a nasty problem. Granted it's probably rare, but I think it would be very nasty.Nastiest right now is that any "length" variable is sometimes hidden.But I meant a temp for the array reference, not the length. (see above)Yep, gotcha. Regan
Mar 08 2005
Good for writing gnomish programs: char[][] phases; phases.length = 3; phases[0 .. 1] = "Collect underpants"; phases[1 .. 2]; phases[2 .. $] = "Profit!"; Totally readable, I agree. :-P But it does not work in GDC... And I *still* just don't see what was wrong with just using phases.length ? --andersI like your comment, but cannot help. :-) Good example BTW, especially "Profit!" part. :-) Ugis
Mar 08 2005
U.Baumanis wrote:That's OK, it's just that GDC is at DMD level 110 now and hasn't got all the new features just yet (but it will) It's something to be aware of, as it has been in the past. All D code should state the minimum compiler version needed to compile. Or at least the version that it was written with ? --andersBut it does not work in GDC...I like your comment, but cannot help. :-)
Mar 08 2005
Walter wrote:I'm not too sure about $, __FILE__ or __LINE__. There might be a better way. http://www.digitalmars.com/d/changelog.html"warning - array 'length' hides other 'length' name in outer scope" ... "The warning can be resolved by: 1. Renaming the outer length to another name. 2. Replacing the use of length within the [ ] with a.length. 3. If length is at global or class scope, and that was the one intended to be used, use .length or this.length to disambiguate. Some proposed language solutions are: 1. Make the length a special symbol or a keyword instead of an implicitly declared variable." You've just added the $ notation, yet you haven't mentioned it here. Simply because it's a trial feature, and the page might end up out of date if you decide to get rid of it? And IMM making length a keyword wouldn't be the Right Thing - we'd lose the ability to use this name for a property in container classes. "Fixed D.bugs/1849" Excellent! Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Mar 08 2005
I think this is a bug: //----------------------------------------------- int bar() { return 0; } bool foo() { return bar()==0; } void main() {} //----------------------------------------------- warning - test.d(2): implicit conversion of expression (bar == 0) of type int to bit can cause loss of data Same happens if bar is instead a variable, but not if it's a constant. Notice, however, that this doesn't produce any warning: int foo() { return null?0:1; } But this does: bool foo() { return null; } _______________________ Carlos Santander Bernal
Mar 08 2005
I'm not too sure about $Oh, Christ Almighty. Coming from a basic background, this is going to look confusing. Strings everywhere.
Mar 08 2005
Jarrett Billingsley wrote:He is indeed. Please don't resort to profanity.I'm not too sure about $Oh, Christ Almighty. Coming from a basic background, this is going to look confusing. Strings everywhere.
Mar 08 2005
We've decided to placate Believers, Agnostics and Atheists on this ng by referring to Bob, who may be what/whomever you choose, or your reader interprets. ;) "Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message news:d0l3vf$b52$1 digitaldaemon.com...I'm not too sure about $Oh, Christ Almighty. Coming from a basic background, this is going to look confusing. Strings everywhere.
Mar 08 2005
Matthew wrote:We've decided to placate Believers, Agnostics and Atheists on this ng by referring to Bob, who may be what/whomever you choose, or your reader interprets. ;) "Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message news:d0l3vf$b52$1 digitaldaemon.com...Bobdamnit!I'm not too sure about $Oh, Christ Almighty. Coming from a basic background, this is going to look confusing. Strings everywhere.
Mar 08 2005
We've decided to placate Believers, Agnostics and Atheists on this ng by referring to Bob, who may be what/whomever you choose, or your reader interprets. ;)Oh, Bob Almighty then.
Mar 09 2005
Walter wrote:http://www.digitalmars.com/d/changelog.htmlhttp://www.digitalmars.com/d/changelog.html#new0116Bugs Fixed:http://www.digitalmars.com/drn-bin/wwwnews?D.gnu/983 a.k.a. "OS X bug: universal alpha identifiers"Programs with non-ascii identifiers do not link, under Mac OS X 10.3 using GDC 0.10... They use the mangled name as a label for the assembler, and then choke on the UTF-8Great, now I can start using all weirdo names! :-) http://www.algonet.se/~afb/d/universalalphas/ Well, when GDC catches up with DMD again that is... (currently gdc 0.10 is at dmd 0.110, feature-wise) --anders
Mar 08 2005