digitalmars.D.bugs - [Issue 3470] New: [tdpl]: .length should not pop up inside indexing expressions.
- d-bugmail puremagic.com (37/37) Nov 03 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3470
- d-bugmail puremagic.com (18/18) Nov 03 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3470
- d-bugmail puremagic.com (16/16) Nov 03 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3470
- d-bugmail puremagic.com (12/21) Nov 04 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3470
- d-bugmail puremagic.com (6/6) Nov 06 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3470
- d-bugmail puremagic.com (12/13) Nov 06 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3470
- d-bugmail puremagic.com (11/11) Mar 12 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3470
http://d.puremagic.com/issues/show_bug.cgi?id=3470 Summary: [tdpl]: .length should not pop up inside indexing expressions. Product: D Version: 2.035 Platform: Other OS/Version: All Status: NEW Keywords: patch Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: clugdbug yahoo.com.au Found this in the "thermoplyae" excerpt. ---- PATCH: dsymbol.c, ArrayScopeSymbol::search(), line 1062 //printf("ArrayScopeSymbol::search('%s', flags = %d)\n", ident->toChars(), flags); - if (ident == Id::length || ident == Id::dollar) + if (ident == Id::dollar) { VarDeclaration **pvar; ---- I have already made the changes to druntime (svn 192) and Phobos (svn 1319), so that they'll pass all unit tests once this change has been made. COMMENT: From the changelog for DMD 0.115 (Mar 7, 2005!!!): $ can now be used instead of length inside an array's []. It represents the length of the array. This is a trial feature, if it works out then these will happen in sequential releases: 1. length will become deprecated inside []. 2. length will be removed as the implicitly declared length, and it will be just another identifier. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 03 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3470 Note for Walter: This is the list of test suite files which are using [length] and need to change to [$]: test16 test23 test34 test42 template4 template6 hospital stress lazy variadic testfile -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 03 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3470 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrei metalanguage.com 05:15:37 PST --- Great work, Don! Since you're there and the code is fresh in your mind, I suggest you operate these two additional changes that were discussed in the newsgroup several times: a) In single-argument index and slice expressions, rewrite $ to __a.length, where __a is the already-evaluated array being indexed/sliced. b) In multi-argument index and slice expressions, rewrite $ to __a.lengths!(n), where n is the compile-time argument position where $ appears. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 03 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3470Great work, Don! Since you're there and the code is fresh in your mind, I suggest you operate these two additional changes that were discussed in the newsgroup several times: a) In single-argument index and slice expressions, rewrite $ to __a.length, where __a is the already-evaluated array being indexed/sliced. b) In multi-argument index and slice expressions, rewrite $ to __a.lengths!(n), where n is the compile-time argument position where $ appears.Actually, the 'opDollar' problem is not very similar to this one, so I'll create a new ticket for it. I've had a go at it. The difficult bit is that currently '$' turns into a symbol, but it needs to become an expression, and it needs the 'this' pointer, which isn't in scope. I can get around this by creating local variables to hold the various values of $ for each dimension, but I'm not sure if that's the right approach. Still not working, but close. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 04 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3470 02:40:23 PST --- Why? Is it because compiler doesn't detect ambiguity/shadowing? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 06 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3470 07:00:23 PST ---Why? Is it because compiler doesn't detect ambiguity/shadowing?There were discussions in the newsgroup in the past. In brief it is bad practice to have the language introduce identifiers automatically in select places. Essentially that makes the identifiers de facto keywords because you shouldn't use them as regular identifiers - they could always be shadowed. Searching the title of the newgroup for "length" shows many related conversations. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 06 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3470 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed DMD2.041. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 12 2010