[Grace-core] Import statements

Marco Servetto marco.servetto at gmail.com
Mon Jun 3 23:46:55 PDT 2013


Sorry, but... is not just better to use directly an url?
like
import "grace.lang/standardLib"

import "kim.com/objectDraw"
and so on? since this stuff is going to be cut-pasted anyway, the
little difference in typing is not going to have any influence.

On 4 June 2013 18:39, Kim Bruce <kim at cs.pomona.edu> wrote:
> Here is a language design (rather than minigrace) issue.
>
> Currently import statements must take a string as an argument.  E.g.
>    import "objectdraw" as od
>
> However, this makes programs fragile, as all the import statement need to be rewritten if the program is moved to a new directory or computer.  I would suggest that we make this a bit more flexible via one of the two following suggestions:
>
> 1.  Allow a prefix to be added to a string:
>
> def base ="home/kim/graceprogs/"
> import base++"objectdraw" as od
>
> 2.  Allow an import to provide an address
>
> in file "platform" put
>
> def objectdraw = "home/kim/graceprogs/objectdraw"
> def gtk = "home/kim/MiniGrace/grace-gtk/gtk"
> ...
>
> then use them as:
>
> import "platform" as platform
> import platform.objectdraw as od
> import platform.gtk as gtk
>
> --------
> Of course, even better would be to combine the two by allowing the base to be defined in "platform".
>
> Is there any reason not to do these?  They make life much easier when using standard libraries, especially when students will be copying them to their own directories and having to fix up library references!
>
> Kim
>
>
>
> _______________________________________________
> Grace-core mailing list
> Grace-core at cecs.pdx.edu
> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core


More information about the Grace-core mailing list