@Jon,

I would like to see more type inference added to Java, something along
the lines that Scala or Fortress does. I am not sure about the
extensive inference common in functional languages; I find the error
messages poor. In fact I have suggested extensions including more
inference already:

http://www.artima.com/weblogs/viewpost.jsp?thread=182412

Changing subject: an example of the expression problem that is
pertinant to discussing computer languages is if you write a parser
for a language and then want to expand the language at a latter date.
In this case you might need to expand the number of expressions to
cope with new language features. I note that there is currently much
work on Haskell to remove this 'closed world' limitation from that
language, so I assume I am not alone if finding 'closed worlds' a
problem.

Cheers,

Howard.

On Nov 12, 11:07 am, Jon Harrop <[EMAIL PROTECTED]> wrote:
> On Sunday 11 November 2007 20:22, hlovatt wrote:
>
> > Most of your arguments seem to be around short syntax not about the
> > semantics of the language. If shorter syntax is of such importance
> > then add some sugar,
>
> The lack of features like inference and automatic generalization is the source
> of verbosity here and you can't address that with sugar: it is a deficiency
> in the language.
>
>
>
> > Moving back to examples, but this time semantic in nature rather than
> > syntactic. Suppose that I was writing a program and using the symbolic
> > math library Exp that was from a supplier, I didn't write it. Now in
> > my program I want to add Pow, but even if I have the code for Exp it
> > isn't a good idea to change Exp since I will have introduced a fork
> > (you don't even want to recompile Exp - just use a binary). With
> > multiple dispatch you can:
>
> > public class Pow extends AbstractExp {
> >   public final Var var;
> >   public final int pow;
> >   public Pow( Var var, int pow ) {
> >     this.var = var;
> >     this.pow = pow;
> >   }
> >   public String toString() { return var + "^" + pow; }
> >   public final static Exp d( Pow p, Var x ) {
> >     if ( p.var != x ) { return new Lit( 0 ); }
> >     return new Mul( new Lit( p.pow ), new Pow( p.var, p.pow - 1) );
> >   }
> > }
>
> > This is hard (I wouldn't say impossible since I don't know ML well
> > enough) in the closed world view of ML semantics.
>
> > In summary: introduce some sugar for common cases; but don't go
> > overboard, because the semantics are the really important thing.
>
> Jacques Garrigues paper on code reuse describes one way of doing that in OCaml
> (using polymorphic variants) but I've never encountered that problem (the
> expression problem) in practice and all solutions to it are necessarily
> invasive.
>
> --
> Dr Jon D Harrop, Flying Frog Consultancy 
> Ltd.http://www.ffconsultancy.com/products/?e


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to jvm-languages@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to