Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - bas

Pages: 1 2 3 [4] 5 6 ... 15
46
Ideas / Re: Variable's name unambiguity
« on: November 13, 2018, 08:55:16 AM »
yes definitely an error. Shadowing is a source of bugs

47
Ideas / Re: Naming restrictions
« on: November 13, 2018, 08:54:39 AM »
Interestingly, we don't use the casing during parsing/analysis, we only check if it's correct.
Since C2 hasn't (yet) solved the issue of (C-code)
Code: [Select]
const int* const
The analyser doesn't see pointer variables as constant. When should a variable be a constant:
if it points to a constant or if it is a constant pointer to a (dynamic) variable?

48
Ideas / Re: Why "recipe.txt" ? :)
« on: November 13, 2018, 08:51:34 AM »
Lol

49
Ideas / Re: What about initialization in conditions?
« on: November 13, 2018, 08:50:38 AM »
Yes, that is how it compiles in C++ also I guess.

50
Ideas / Re: [Email suggestion No. 3] type casts in C2 + bugs
« on: November 13, 2018, 08:49:24 AM »
I think the expr as type idea is also nice. The only nasty thing I can think of is during parsing.
The type after as, like: (fabricated example)

Code: [Select]
x = y as u32* * 10;
So the parser sees to asterixes, so is it a pointer to a pointer to u32 or a multiplication?

51
Ideas / Re: Does C2 support this? Otherwise it should. "Labels as values"
« on: November 13, 2018, 08:43:48 AM »
Indeed, It could be used for some corner cases. Let's put it on the backlog somewhere

52
Ideas / Re: Vtables and similar ”OO”-ish concerns
« on: November 13, 2018, 08:42:09 AM »
Yes, nice overview. I often use the Method Dispatch method described there..

53
Ideas / Re: One more big thing: Errors
« on: November 12, 2018, 10:20:39 AM »
There are so many situations (performance/memory-wise) that forcing a single solution in a language lowish-level language
like C2 is a good idea. Of course offering a solution that a developer can choose is fine if this doesn't add too much complexity
to the language overall..

54
Ideas / Re: Relax variable initialization rules
« on: November 12, 2018, 10:16:10 AM »
The last example compiles fine already. But for global arrays, it's not allowed since that could induce 'race conditions' between constants

55
Ideas / Re: Dynamic arrays & fixed arrays
« on: November 12, 2018, 10:13:01 AM »
There are so many features pending alread, I find it hard to decide on every one. Ideally for a feature, it's optional and can be added to a language at a later stage without
breaking user code. For defer() this seems to be the case. If that's also possible for this case, we could add it later, or just do some proto-typing (without implementation) first.

56
Ideas / Re: Tagged unions
« on: November 12, 2018, 10:10:16 AM »
Ahh that makes it clear what tagged unions are. I would prefer to keep this out of the language as
it generates 'underwater' code.

57
Ideas / Re: Enum improvements
« on: November 12, 2018, 10:04:46 AM »
I can see why developers would want struct constants as a way to 'scope' a constant and connect
it to a struct. But I think modules already give us some grouping/scoping for this and adding struct
constants just adds complexity. It is currently already possible to indeed add a struct function that
is compile time constant, so that would already allow some scoping/grouping..

58
Ideas / Re: Add defer
« on: November 09, 2018, 08:48:34 PM »
Hmm seems like an interesting idea.
Since C2 is a language where nothing happens behind the screens, I do prefer a situation where defer must be called manually.

What I don't get from the Go examples is that the defer expr seems to be evaluated at the moment the defer is set, not when
the scope ends and it's actually run..

I'll put defer on the Roadmap..

59
Ideas / Re: Does C2 support this? Otherwise it should. "Labels as values"
« on: November 09, 2018, 08:39:12 PM »
Wow, I never even knew that was possible in C. I have also never ever found the need for it as well ;)
I think this can safely be removed.

60
General Discussion / Re: Overview of syntax
« on: November 09, 2018, 08:37:15 PM »
As a fun experiment, just take a piece of C/C++ code and remove all the semi-colons (in vim: %s/;//g )
Now just look at the code before and after..

Pages: 1 2 3 [4] 5 6 ... 15