[bitc-dev] Syntax Poll: Polymorphic Types
Sandro Magi
smagi at higherlogics.com
Thu Mar 5 14:19:12 EST 2009
Jonathan S. Shapiro wrote:
> It's subjectively more readable:
>
> char list vs. list [of] char.
>
> >From my perspective, the concern would be on the one hand that this
> readability may not extend gracefully to multiple type arguments (in
> OCaml these are parenthesized), but on the other that the prefix
> notation wants to look like application, and I'm not sure how that's
> going to work out (need to try it in the parser).
How are type arguments delineated? I'm not clear on how you plan to
handle this as opposed to OCaml's "single-arg everywhere" approach.
Either of the above two approaches are perfectly readable, as long as
you don't introduce bracketing for type arguments ala C#, ie.
List<char>, which quickly becomes unreadable with nested types. Suppose
you had:
type charOrStringList = (char, string) either list
The reverse looks a little more natural to me because I work with C# daily:
type charOrStringList = list either (char, string)
You unwrap this type from left to right, instead of having to check the
end for the first type to unwrap. Still, it's been awhile since I did
any serious OCaml programming, so that could just my bias talking.
Sandro
More information about the bitc-dev
mailing list