Skip to content

Explanation about the use of '@' token #76

Answered by edubart
stefanos82 asked this question in Q&A
Discussion options

You must be logged in to vote

What got me wondered though is why we need to have a typecast method and not something like local c: auto = @[]integer{1,2,3,4}?

Because the syntax would be ambiguous for other type expressions, suppose (@[4]integer){1,2,3,4} could be simplified to @[4]integer{1,2,3,4}, then (@integer)(1) would be also simplified to @integer(1) as a side effect, but now integer(1) is ambiguous, is this a type initialization or a generic type? This is an example, there are other syntax problems in allowing that, for both the parser and the reader. Type expressions in the middle of usual expressions must be surrounded by (@ ) because dropping these tokens make many cases ambiguous and confusing. This is b…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@stefanos82
Comment options

Answer selected by edubart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants