A Discussion of Tuple Syntax

Jacob Carlborg doob at me.com
Tue Aug 20 04:01:22 PDT 2013


On 2013-08-20 05:33, Kenji Hara wrote:

> If you want to return multiple values from a function, you must always
> wrap them by std.typecons.Tuple, or other used-defined types. You cannot
> directly return built-in tuple from a function.
> (Built-in tuple return is mostly equivalent with multiple-value-return
> issue. However it would be mostly impossible that defining calling
> conversion scheme for that in portable)

If I recall correctly some ABI's passes small structs in registers, at 
least I think it does on Mac OS X.

> My opinions agains various syntax proposals:
>
> #(1, "str")
> --> The character '#' is already used for the start of "Special Token
> Sequences"
> http://dlang.org/lex.html#Special Token Sequence
>
> It is recognized in lexing phase, so adding semantic meaning to the '#'
> character would be a contradict of D's principle.
>
> Quote from http://dlang.org/lex.html
> "The lexical analysis is independent of the syntax parsing and the
> semantic analysis."

It depends on how it's lexed. If the compiler lexes "#line" as a single 
token I cannot see how it will be a problem. Then the "#" token would 
mean tuple literal.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list