CatalaLang / catala

Programming language for literate programming law specification
https://catala-lang.org
Apache License 2.0
1.99k stars 77 forks source link

`context` variables are hard to understand #667

Open AltGr opened 3 months ago

AltGr commented 3 months ago

input and output vars are reasonably easy to make sense of, but the third kind, context, is I think a tripping point when learning the language. The tutorial could be improved in that area, but I believe the name "context" is part of the problem here, it requires meta-understanding of the language structure to figure out why it was named that way.

I believe replacing it with something much simpler like optional input could make things much clearer.

denismerigoux commented 1 month ago

Decision of the syntax committee : replace context/contexte with :

AltGr commented 1 month ago

Additional note: like you can have combined input output variables (that are actually two different variables under the hood), you can have context output variables that are both context and output.

That would yield:

I am afraid that the superposition could make things a little confusing again. A possibility would be to force the conjunction and ? input and output VAR / input with default and output VAR / entrée et résultat VAR / entrée par défaut et résultat VAR