[bitc-dev] DISCUSS: quasi-object syntax
Swaroop Sridhar
swaroop at cs.jhu.edu
Thu Jul 17 10:39:03 CDT 2008
Jonathan S. Shapiro wrote:
> BitC is both object-disoriented and dysfunctional :-). A fairly simple
> hack would restore much of the surface idiom of object-oriented
> programming, and I would like feedback on whether it should be
> considered.
>
> Syntax hack:
>
> Given an application of the form
>
> (a.x [args])
>
> we first attempt to resolve 'x' as a field name within a. If no
> such field name exists, we rewrite the application as
>
> (x a [args])
>
> and see if we can resolve that.
>
> This is nothing more or less than a disgusting hack, but I sort of
> suspect that it would work most of the time.
>
> Alternative: instead of overloading "." (which is what makes this
> horrible) we could use some other form of punctuation, in which case
> this is pure sugar.
I would definitely opt for picking some other punctuation in this case.
The '.' operator is already quire overloaded:
1) Select fields from structures (including constructors)
2) Select constructor name from a type name (ex: list.cons)
3) Select bindings from interfaces
The programmer might also get unexpected error messages due to
over-overloading.
Swaroop.
More information about the bitc-dev
mailing list