Skip to content

Silly question about "_". #747

Answered by msadeqhe
marcovc asked this question in Q&A
Oct 12, 2023 · 3 comments · 17 replies
Discussion options

You must be logged in to vote

That's a good question. Actually _ is optional except for template parameters:

fnc1: (x: _) -> _ = x + 1;
fnc2: (x)           x + 1;

var1: _ = 10;
var2:   = 10;

// Type template parameter
cls1: <T: type> type = { }
cls2: <T>       type = { }

// Non-type template parameter
cls3: <T: _> type = { }

Because "type template parameters" are the default type. If we want "non-type template parameters", we have to explicitly write it.

Replies: 3 comments 17 replies

Comment options

You must be logged in to vote
14 replies
@JohelEGP
Comment options

@jcanizales
Comment options

@JohelEGP
Comment options

@jcanizales
Comment options

@JohelEGP
Comment options

Answer selected by marcovc
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@JohelEGP
Comment options

@msadeqhe
Comment options

@ntrel
Comment options

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