[Issue 6365] AutoTupleDeclaration

2011-12-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #40 from bearophile_h...@eml.cc 2011-12-14 00:01:37 PST --- Some people agree with me that mass assignment syntax for tuples is bad, it's an anti-feature: auto (i, j) = 10; assert(i == 10); assert(j == 10); Like Alex R. Petersen:

[Issue 6365] AutoTupleDeclaration

2011-11-18 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #38 from bearophile_h...@eml.cc 2011-11-18 18:10:20 PST --- See also bug 4579 -- Another handy sub-feature. Sometimes you have tuples with N items, but you only want to unpack some of them. This syntax doesn't work

[Issue 6365] AutoTupleDeclaration

2011-11-18 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #39 from bearophile_h...@eml.cc 2011-11-18 18:11:33 PST --- Please ignore the This syntax doesn't work because _ is a valid variable name (and even if there's only one of them I don't want to define a _ variable): part of the

[Issue 6365] AutoTupleDeclaration

2011-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #36 from Kenji Hara k.hara...@gmail.com 2011-10-20 19:08:36 PDT --- Scala has similar syntax. http://www.scala-lang.org/docu/files/ScalaReference.pdf p.170 | Changes in Version 2.6.1 (30-Nov-2007) | Mutable variables introduced by

[Issue 6365] AutoTupleDeclaration

2011-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #37 from Kenji Hara k.hara...@gmail.com 2011-10-20 19:20:06 PDT --- (In reply to comment #34) We should really strive to get a consistent syntax for this. auto (x, y) is a totally specialized syntax. See comment #19. It is a

[Issue 6365] AutoTupleDeclaration

2011-09-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 d...@dawgfoto.de changed: What|Removed |Added CC||d...@dawgfoto.de --- Comment #34

[Issue 6365] AutoTupleDeclaration

2011-09-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #35 from d...@dawgfoto.de 2011-09-08 10:15:17 PDT --- (In reply to comment #34) (auto a, b) = (2, 3); This would actually call for 'auto tup = (2, 3);' '(auto a, b) tup = (2, 3);' || 'auto tup@(a, b) = (2, 3);'. So you can pass

[Issue 6365] AutoTupleDeclaration

2011-08-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Keywords||patch --- Comment #33

[Issue 6365] AutoTupleDeclaration

2011-08-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #32 from bearophile_h...@eml.cc 2011-08-22 23:52:53 PDT --- See also issue 6544 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---

[Issue 6365] AutoTupleDeclaration

2011-08-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #30 from bearophile_h...@eml.cc 2011-08-18 23:35:27 PDT --- (In reply to comment #26) We should step back and figure out what we want to do with tuples in the much more general case. I think this point is mostly solved, because

[Issue 6365] AutoTupleDeclaration

2011-08-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #31 from bearophile_h...@eml.cc 2011-08-18 23:47:46 PDT --- Regarding this change, removing tuple unpacking for arrays is not a good idea, in my opinion. You are making tuples less handy, with zero gain in doing so.

[Issue 6365] AutoTupleDeclaration

2011-08-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #29 from bearophile_h...@eml.cc 2011-08-08 14:48:37 PDT --- (In reply to comment #26) If we grow tuple support by adding piecemeal special cases for this and that, without thinking about them more globally, we are liable to build

[Issue 6365] AutoTupleDeclaration

2011-08-03 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #28 from bearophile_h...@eml.cc 2011-08-03 04:35:25 PDT --- See also the discussion here: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.Darticle_id=141640 -- Configure issuemail:

[Issue 6365] AutoTupleDeclaration

2011-08-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added CC|

[Issue 6365] AutoTupleDeclaration

2011-08-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #27 from Kenji Hara k.hara...@gmail.com 2011-08-02 06:39:43 PDT --- (In reply to comment #26) Thanks for your reply. I have two claims. 1. D language specification already implicitly allow automatic tuple expansion. a) Alias

[Issue 6365] AutoTupleDeclaration

2011-07-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #24 from Kenji Hara k.hara...@gmail.com 2011-07-26 02:45:09 PDT --- (In reply to comment #1) Also we can allow a static array on initializer like follows: auto (x, y) = [10, 20]; assert(x == 10); assert(y == 20); A few days

[Issue 6365] AutoTupleDeclaration

2011-07-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #25 from bearophile_h...@eml.cc 2011-07-26 06:53:52 PDT --- (In reply to comment #23) I'd say let's not go overboard. auto (names) = initializer; sounds like the good thing to do, so let's do it. The rest are considerably more

[Issue 6365] AutoTupleDeclaration

2011-07-25 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #22 from bearophile_h...@eml.cc 2011-07-25 19:56:30 PDT --- Two quite useful use cases: A) int[] array = [1, 2]; // dynamic array auto (x, y) = array; // raises a run-time exception if array.length != 2 B) auto (x, y, z) =

[Issue 6365] AutoTupleDeclaration

2011-07-25 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #23 from Andrei Alexandrescu and...@metalanguage.com 2011-07-25 21:03:44 PDT --- (In reply to comment #22) Two quite useful use cases: A) int[] array = [1, 2]; // dynamic array auto (x, y) = array; // raises a run-time

[Issue 6365] AutoTupleDeclaration

2011-07-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #15 from Kenji Hara k.hara...@gmail.com 2011-07-24 06:41:36 PDT --- I found a conflict like follows: (double, string) (i, j) = tuple(1.2, a); (var, func)(var, var) = tuple(1.2, a); So it is bad. I clean up syntax, and update

[Issue 6365] AutoTupleDeclaration

2011-07-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #16 from bearophile_h...@eml.cc 2011-07-24 07:24:53 PDT --- (In reply to comment #15) I clean up syntax, and update patch. https://github.com/9rnsr/dmd/compare/expandTuples...declarationTuple Thank you. How does it behave for:

[Issue 6365] AutoTupleDeclaration

2011-07-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #17 from Kenji Hara k.hara...@gmail.com 2011-07-24 07:38:49 PDT --- (In reply to comment #16) How does it behave for 0-tuples and 1-tuples? I think 1-element tuple expansion should be allowed. Now my patch's this support is

[Issue 6365] AutoTupleDeclaration

2011-07-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #18 from bearophile_h...@eml.cc 2011-07-24 11:14:57 PDT --- (In reply to comment #17) // 1-tuple expansion auto (x1) = [10]; Are you sure you want to use that syntax? A syntax more similar to the Python one is: auto (x1,) =

[Issue 6365] AutoTupleDeclaration

2011-07-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #21 from Kenji Hara k.hara...@gmail.com 2011-07-24 12:20:00 PDT --- (In reply to comment #20) This too is valid D code: auto a = [1, 2,]; I didn't know that. Thank you. cut In this case, TupleDeclaration syntax is similar to

[Issue 6365] AutoTupleDeclaration

2011-07-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #1 from Kenji Hara k.hara...@gmail.com 2011-07-23 05:08:51 PDT --- Also we can allow a static array on initializer like follows: auto (x, y) = [10, 20]; assert(x == 10); assert(y == 20); But, it has a bit problem. auto (x, y) =

[Issue 6365] AutoTupleDeclaration

2011-07-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc ---

[Issue 6365] AutoTupleDeclaration

2011-07-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #3 from Kenji Hara k.hara...@gmail.com 2011-07-23 05:17:57 PDT --- (In reply to comment #2) (In reply to comment #0) auto (n1, n2) = 100; // non tuple initializer assert(n1 == 100); assert(n2 == 100); This *must* be a

[Issue 6365] AutoTupleDeclaration

2011-07-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #4 from bearophile_h...@eml.cc 2011-07-23 05:18:55 PDT --- Optionally there is the foreach use case too. A possible syntax: auto array = [tuple(1,foo), tuple(2,bar)]; foreach (tuple(id, name); array) {} -- Configure issuemail:

[Issue 6365] AutoTupleDeclaration

2011-07-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #5 from bearophile_h...@eml.cc 2011-07-23 05:23:06 PDT --- (In reply to comment #3) This is keeping consistent feature. Current D allow compilation of following code: TypeTuple!(int, int) f = 10; assert(f[0] == 10);

[Issue 6365] AutoTupleDeclaration

2011-07-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #6 from Kenji Hara k.hara...@gmail.com 2011-07-23 05:27:14 PDT --- (In reply to comment #4) Optionally there is the foreach use case too. A possible syntax: auto array = [tuple(1,foo), tuple(2,bar)]; foreach (tuple(id, name);

[Issue 6365] AutoTupleDeclaration

2011-07-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #8 from Andrei Alexandrescu and...@metalanguage.com 2011-07-23 07:33:33 PDT --- Regarding mismatch in the number of elements, we may actually do good to disable TypeTuple!(int, int) f = 10; assert(f[0] == 10); assert(f[1] == 10);

[Issue 6365] AutoTupleDeclaration

2011-07-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 Andrei Alexandrescu and...@metalanguage.com changed: What|Removed |Added CC|

[Issue 6365] AutoTupleDeclaration

2011-07-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #9 from bearophile_h...@eml.cc 2011-07-23 07:48:46 PDT --- (In reply to comment #8) Regarding mismatch in the number of elements, we may actually do good to disable TypeTuple!(int, int) f = 10; assert(f[0] == 10); assert(f[1]

[Issue 6365] AutoTupleDeclaration

2011-07-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #10 from Kenji Hara k.hara...@gmail.com 2011-07-23 08:28:08 PDT --- (In reply to comment #7) One simple syntactic matter is that we can't extend the existing syntax to work with specified types. That means the user must use

[Issue 6365] AutoTupleDeclaration

2011-07-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #11 from Kenji Hara k.hara...@gmail.com 2011-07-23 08:33:10 PDT --- Oops, I forgot to paste experimental patch link. https://github.com/9rnsr/dmd/compare/expandTuples...declarationTuple -- Configure issuemail:

[Issue 6365] AutoTupleDeclaration

2011-07-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #12 from bearophile_h...@eml.cc 2011-07-23 09:03:24 PDT --- (In reply to comment #10) (In reply to comment #7) (auto i, j) = tuple(1.2, a); Then the syntax can be later extended to: (double i, string j) = tuple(1.2, a);

[Issue 6365] AutoTupleDeclaration

2011-07-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #13 from bearophile_h...@eml.cc 2011-07-23 12:04:19 PDT --- Tuple slicing and other situations create tuples with 1 items or 0 items: auto t = tuple(1.5, foo); auto t1 = t[0 .. 1]; auto t2 = t[0 .. 0]; In python they are written:

[Issue 6365] AutoTupleDeclaration

2011-07-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6365 --- Comment #14 from bearophile_h...@eml.cc 2011-07-23 12:14:23 PDT --- See also the idea of switching on tuples, in issue 596 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail