eclipse-archived / ceylon.formatter

A formatter for the Ceylon programming language, written in Ceylon.
Apache License 2.0
14 stars 11 forks source link

Source-gen: CombinedOptions and optional FormattingOptions types #15

Closed lucaswerkmeister closed 10 years ago

lucaswerkmeister commented 10 years ago

Similar to #14, CombinedOptions don’t work very well with optional types. Maybe we should have a special type UnsetOption of unset {}; and use that for SparseFormattingOptions and CombinedOptions instead?

lucaswerkmeister commented 10 years ago

Actually, I’d rather have it the other way around: That option types should not be optional and instead should have types like

Integer|None maxLinewidth

where

abstract class None of none|unlimited|...

so that people can write maxLinewidth = unlimited.

lucaswerkmeister commented 10 years ago

and why should unlimited, none, etc. all be the same type? It would probably make even more sense to have

Integer|Unlimited maxLineWidth
// ---
maxLineWidth = unlimited

The only problem I see with that is that it leaves us with a lot of singleton classes. It’s a shame that we can’t write Integer|unlimited... (but I guess that would make the grammar ambiguous: obj1 obj2 = obj1;)