You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And realized that maybe C2 needs a convention (or a way) to name / signal "internal" (I wouldn't use 'private') fields.
There are a few options:
Name convention: "_foo" – Dart does this, and they actually skip "private/public" by saying anything with "_" is private.
Keyword: "private foo" / "internal foo" / "local foo" in the struct declaration together with have to use some special way to get hold of it. In the case of c2vector2: c = v.capacity and maybe a = v.$total or c = (private v).total or c = private v.total (not beautiful solutions, just describing the options we have)
Sigil: e.g. "$foo" like in type Foo struct { int $foo; }
The text was updated successfully, but these errors were encountered:
This is related to the discussions on whether to allow struct functions to use (struct) variables without the self. prefix. Just like C++ etc. I think this will make a lot of code more readable. C2 does (will) not have the public/private stuff, but it might be good to signal a member access. This does make the case var.member and (in structfunc) _member different... Hmm
If it was a lang from scratch I would have suggested a sigil if you wanted to access a struct member in a struct function, but that is too much of a change I think.
In JaI, ”using X” would give direct access to members in the function.
I’m two minds about this. Because having to deal with access directly emphasises the fact that one must deal with the null-pointer scenario.
I was looking at this: https://github.com/c2hub/c2vector/blob/master/c2vector/c2vector.c2
And realized that maybe C2 needs a convention (or a way) to name / signal "internal" (I wouldn't use 'private') fields.
There are a few options:
c = v.capacity
and maybea = v.$total
orc = (private v).total
orc = private v.total
(not beautiful solutions, just describing the options we have)$foo
" like intype Foo struct { int $foo; }
The text was updated successfully, but these errors were encountered: