effekt
effekt copied to clipboard
Renaming of keywords and types
I would like to see the following syntactic changes. They have to be discussed and rejected or approved.
- rename type
Boolean
toBit
- rename keyword
type
todatatype
- keep keyword
type
for type aliases - change syntax
var x = 1; ...
tovar x := 1; ...
- change syntax
x = 1; ...
tox := 1; ...
- remove
return
statement - remove
with
statement - sequence constructors not with semicolons
type B { True(); False() }
buttype B { case True() case False() }
- create instances without keyword
new
likedef x = State { def get() = 1 def set(y: Int) = () }
- put the condition in
while
in curly braceswhile { cond } { body }
Boolean
toBit
I fear this will confuse everybody. Almost all languages have booleans (or i2 ;) ). What about Bool
?
type
todatatype
I know that this is analogous to the length of the name interface
. Effekt is already quite verbose to type in demos, what about data
?
remove
return
statement
You don't have to use it. I just added it for demos to sometimes explicitly mark returns.
remove
with
statement
Ideally we redesign it, not drop it. In Shonan discussions it became visible that something like a with statement is essential for practical use.
sequence constructors
Again, this makes things more verbose (I know duality to the destructor site). I have to think about this one---not sure yet I like it.
create instances without keyword
I think this cannot work syntactically, we already have a lot of type-directed overloads. Now look at Empty {}
-- is this a function call? Creating a new object? I would have a hard time disambiguating this. Maybe see it like this: data is syntactically biased towards construction, codata towards observation.
put the condition
This is another thing that will heavily confuse people. The only reason for doing this would be to move it to the stdlib:
def while { cond: => Bool } { prog: => Unit }: Unit = {
def go(): Unit = if (cond()) { prog(); go() } else { () }
go()
}
Actually, I forgot, did I add while(cond) { p1 } else { p2 }
to the language? I meant to at some point.
I want to add something to this list: Desugar resume()
to resume(())
.
Alternatively, allow effect operations to have 0 return values.
this is hopefully already addressed by #272
Since we're talking about this IRL (cc @phischu @marzipankaiser):
- rename keyword
type
todatatype
If we want to actually align interface
and datatype
, we could use data type
(and then type
can be left as a type alias :) )
[brought to you by the 🚲🏠 Effekt working group]
Let's not take this pun too far. I'd like to pick keywords primarily for three reasons:
- how easy they are to use (interface is not here here, too long)
- how easy they are to explain (interface is perfect here)
- how well they fit with other concepts and keywords
I definitely prefer data
over type, datatype, or data type