Destructuring syntax in julia 1.7

I’m aware of that logic and I agree that it is quite clever. My worry is mainly that it is a bit too clever.

Playing along with these ideas, one could argue that (1; a=2) should be a mixed positional and named tuple. Instead, it’s a shorthand begin ... end block equivalent to simply a = 2. Similarly, one might expect the following to work:

julia> (first_entry; diag) = Diagonal([1,2])
ERROR: syntax: invalid assignment location "begin
    # REPL[10], line 1
end" around REPL[10]:1

those sound like nice features to me. If you write the PR, I’ll give it a thumbs up :grinning_face_with_smiling_eyes:

Ref GitHub - ararslan/FrankenTuples.jl: Part Tuple, part NamedTuple... it's alive!


The (expr1; expr2) syntax for a block long predates named tuples. You’re right that if we’d had foreseen that it would eventually make sense as a frakentuple syntax, then we might have reserved the syntax for that. Of course, I’m not sure if frankentuples will even be added to the language, let alone need a syntax, so for now the fact that this syntax means something else seems fine. Syntax collisions happen and when they do, you just have to pick one of the possible meanings (or error because it’s ambiguous, but that’s kind of annoying).