DreamBerd icon indicating copy to clipboard operation
DreamBerd copied to clipboard

`create` keyword

Open hampuslidin opened this issue 2 years ago • 3 comments

Please add the create keyword, which is the opposite of the delete keyword, that let's you create new syntax on the spot:

create imaginary
imaginary const const const number = 2i

If the keyword is undesired, you can always delete it, meeting everyones need:

delete create

hampuslidin avatar Jun 22 '23 07:06 hampuslidin

We have something like that already: #133

stohrendorf avatar Jun 22 '23 07:06 stohrendorf

Fair point, but this is not just operators but keywords as well. For instance, the language currently has read-only variables (const) and read-write (var), but not write-only and no-read-write. Instead of overcomplicating the language with additional builtin keywords, one could achieve the same effect with create:

create sink             // write-only
sink secret = 123
print(secret)           // not allowed

create blackhole        // no read or write
blackhole what
what = 1                // not allowed
print(what)             // not allowed

(using AEMI for brevity here)

hampuslidin avatar Jun 22 '23 07:06 hampuslidin

this is a nice idea

TodePond avatar Jun 22 '23 08:06 TodePond

I agree @TodePond !

I am actually working on a language called DreamLang like this. I will add that feature to the language.

gooddavvy avatar Jun 25 '23 18:06 gooddavvy