Hi,
I started porting over some code from
https://github.com/kevin-wayne/algs4 to learn Chapel better, and I have
some questions. For those who haven't seen it, this is the Java code for
Sedgewick's "Algorithms 4th Ed" and it's fairly plain Java code, not even
using interfaces, which Chapel lacks, all that much. I'd like to match the
structure of the Java code and the naming conventions as closely as is
tasteful. I don't know how to do what I want and the spec is unenlightening
so I'm hacking with 1.16.
In Java we have packages and classes, and all of the library is in a
package "edu.princeton.cs.algs4" using Java's reverse URL package naming.
Say I want to name my package 'Algs", so that my implementation of a
LinkedStack would be a record Algs.LinkedStack.T (T is for type, more on
that later). The only way I can see to do that now is to have a module Algs
which contains all of my algorithms in one file. Is there any way that I
can have that behavior (all modules accessible by Algs.Modname) and be able
to split my implementation across files, like in Java, or like Ada package
subunits?
I also noticed that Chapel doesn't seem to permit types and their
parent module to have the same name. Originally I had tried to have a
module Stack with a (record) type Stack like
module Stack {
class Node {
type ItemType; // type of item
...
}
record Stack {
}
}
but the Chapel compiler rejects that. Is that supposed to be the behavior
of modules? I settled on the OCaml-ish convention of naming the main type
from the module "T" because of this, but I'd like to know if it's necessary.
I think an example of how to organize multifile/multimodule libraries in
Chapel would be enlightening. Packing everything into one file, as I see in
the examples in the mason registry, is not a solution I'm comfortable with.
-- Brian
PS: Chapel could also do with some naming and formatting conventions. I'm
trying to stick with Java-ish conventions (well, Java packages are
typically lower cased and I haven't done that yet...) and "One True Brace
Style" with non-optional braces (like Rust) and the Chapel code I read
varies greatly in style.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users