Bob Nystrom

Results 973 comments of Bob Nystrom

> So should the error message say > > ``` > type 'bool' is not a subtype of type 'int' > ``` > > instead of > > ``` >...

Ah, I'm glad you raised this because it's an important design point. I think of it as deciding whether a tuple represents a *concatenation* of its elements or a *collection*...

> I think a lot of that makes a lot of sense, but I'm not sure I agree about #4. Why can't `var (a) = record2` grab the first value,...

> I'd consider not allowing partial record matches without extra syntax. > > That would mean writing something like > > ```dart > var (a, ...) = biggerRecord; > ```...

> If the syntax required you to write `var` in front of any variable introduction, so an actual binding pattern would be: > > ```dart > describe(String s) { >...

> I admit I have a very hard time reading > > ```dart > var (parseInt(x), parseInt(y)) = ("123", "345"); > print(x + y); // "468". > ``` > >...

The proposal has changed somewhat since most of this discussion happened. In particular: * The record pattern syntax now *only* matches records and does not allow calling getters on arbitrary...

Yeah, it's not idea. But, for what it's worth, Python allows semantically-ignored trailing commas in list literals and argument lists and also uses `(foo,)` as the syntax for one-element tuples.

I think we can be better than Python overall (for many use cases) without needing to be superior specifically in the area of "using trailing commas to indicate single-element tuples"....