Tonio's Dev blog

Thursday, February 01, 2007

This week-end, i decided (slightly influenced by Pierre-Étienne) to implement a new and shiny feature in Gom: the possiblility to specify packages in module names.

This feature in cool, as it removes the need to use a compilation option to integrate the Gom data structure in a project: you simply have to name your module accordingly to the package.

Previously, to place the module "Peano" in the "classical" package, we had to write the Peano module in a file, Peano.gom

module Peano
abstract syntax
Nat = zero() | suc(n:Nat)

and then to compile it with gom -p classical Peano.gom

Then, for each gom file in a project, the call was different ! That's not fun if you are used to javac.
Now, we simply write

module classical.Peano
abstract syntax
Nat = zero() | suc(n:Nat)

and compile it with gom Peano.gom

Once prepared to implement that, found what to change in the design, and all, i simply read the Changelog, and found the entry

2006-11-04 tonio
* src/tom/gom/parser/:
- add support for qualifier module names
the module "dir.mod" is similar to the declaration
of a module "mod" compiled with "--package dir" option

I'm not sure I should add a new entry simply because I thought about implementing that a second time.

0 Comments:

Post a Comment

<< Home