posts from @JoshJers tagged #programmign languages

also:

One thing I'm having trouble with in my programming language dev project is scoped vs. unscoped blocks.

For instance, normally if you have variables inside of a { } block, they're scoped to that block (when the block ends they no longer exist).

However, I have need of an unscoped block, mainly for compile-time conditions.

In C/C++, these conditions are usually written as:

#if fooo
...
#endif 

but I don't actually have a preprocessor so it'd be nice to have something closer to the rest of the language. something like:

if const(foo)
#{
  // do something only if foo is true at compile time
}#

the only problem is I don't love the #{ }# bracing that I have there - but I haven't come up with anything better.

[] and () are already widely used, <> is a parsing nightmare (since they're used in other places as unbalanced operators), I don't really want to use : since it's also widely in use.

Has anyone seen a language that has distinct scoped and unscoped blocks? What did that look like?