Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
April 29, 2010 [Issue 4133] New: Enable __traits on D1 | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=4133 Summary: Enable __traits on D1 Product: D Version: future Platform: Other OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: nfxjfg@gmail.com --- Comment #0 from nfxjfg@gmail.com 2010-04-29 01:42:05 PDT --- Not having __traits is a pain in the ass, and I bet there's not a single technical reason not to enable it on D1. Names prefixed with __ are compiler reserved, and thus can't break existing D1 programs. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 01, 2010 [Issue 4133] Enable __traits on D1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=4133 --- Comment #1 from nfxjfg@gmail.com 2010-05-01 11:14:41 PDT --- Created an attachment (id=616) enable __traits in D1 I figured it was unfair to leave all the work to Walter, so I wrote a patch. It was simple: mostly I had to remove a bunch of "#if DMDV2", and copy some missing bits from the D2 source tree (which is slightly different from the D1 tree, whatever). The D1 traits.c file was outdated (I don't know why), so I just appended D2's traits.c to it (to keep the diff non-confusing). Note that I still made s small change to the copied part, oh well. I tried all examples from http://www.digitalmars.com/d/2.0/traits.html, and all seemed to work correctly. Note that you can't write "auto b = [ __traits(allMembers, D) ];" in D1, instead you have to use "char[][] b = [ __traits(allMembers, D) ];" (array type inference was changed in D2). This patch is against the dmd 1.059 Beta, which (probably) corresponds dmd svn revision 461. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 06, 2010 [Issue 4133] Enable __traits on D1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=4133 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug@yahoo.com.au --- Comment #2 from Don <clugdbug@yahoo.com.au> 2010-05-06 00:51:10 PDT --- This is quite premature, since __traits is still experimental in D2, and its syntax will hopefully change. It is deliberately not mentioned in Andrei's book. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 06, 2010 [Issue 4133] Enable __traits on D1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=4133 --- Comment #3 from nfxjfg@gmail.com 2010-05-06 01:09:09 PDT --- That's true, but it can change in D1 as well. If enhancement #3702 gets accepted, the magic namespace can be prefixed with "std." or "__" in D1 to maintain backwards compatibility. But I don't really think __traits will go away so fast. Anyway, this feature would be really helpful. Many D1 users are tired of parsing .stringof results to get their stuff done, but they can't suddenly switch to D2 either. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 26, 2010 [Issue 4133] Enable __traits on D1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=4133 Trass3r <mrmocool@gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mrmocool@gmx.de --- Comment #4 from Trass3r <mrmocool@gmx.de> 2010-05-26 15:13:13 PDT --- > you have to use "char[][] b = [__traits(allMembers, D) ];" allMembers returns a tuple now which is a lot better for compile-time iterations. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 26, 2010 [Issue 4133] Enable __traits on D1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=4133 --- Comment #5 from nfxjfg@gmail.com 2010-05-26 15:37:29 PDT --- I was just saying you have to use "char[][] b = [...]" instead of "auto b = [...]". This is the only point where you have to modify the examples in the traits documentation to make it work on D1+this patch. That change doesn't have to do anything with __traits or this patch. It's just that "auto b = ["a", "bc"];" simply doesn't compile in D1. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 07, 2011 [Issue 4133] Enable __traits on D1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=4133 nfxjfg@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation