[Grace-core] Collection naming
James Noble
kjx at ecs.vuw.ac.nz
Mon Jun 30 14:27:39 PDT 2014
> A couple of points:
> 1) Having both set and set(1,2,3) be valid calls seems like asking for trouble -- a minor typo will likely set in motion very strange effects that will be hard to decipher by the programmer.
probably. Although (without the type checker always on)
I make typos using set (the class) instead of set.with(1,2,3) (an instance)
> 2) If you are intent on avoiding the "." notation then emptySet and setWith(...) seem quite reasonable names. I also don't find setFromCollection(...) too bad for creating a set from another collection. I don't really see the point of using the other names. Hence I don't find it troubling about not having an "exploding" argument list. Adding it in seems intuitively as something that couldn't be done in the language, so I'm reluctant to add it to the language without stronger motivation.
yes - although keeping the dot makes it easier to import stuff.
> 3) I think naming is important and think we should try to come up with some recommended naming scheme for classes. Types seem to be fine as nouns starting with capital letters: Point, Graphic, Number, Set, ... But should our classes be aPoint, point, or ????
I agree to, we can talk about this (esp if Andrew can make it, no doubt jetlagged)
I lean towards point as the class, Point as the type, aPoint as a variable of type Point...
(but mostly because that aligns with my previous background)
one option slightly disagreeing with one of my long emails from last light:
if we keep matchfix [ ] for e.g. building built-in immutable sequences
that's a way around Andrew's problem of having to provide three different constructors
just provide one that takes a collection, and [x] lifts a single object to a collection (saving
we could even keep [] as empty-seq .... so you'd only need one constructor for all three cases.
Of course, presumably other (optimised) cases would do more work internally or something.
BUT
- there's an ambiguity with indexing I'd love to avoid! - foo[1,2] vs foo [1,2]
- doesn't feel that "OO" to build in sequences. then we build in pattern matching, then we are Gradual O'CAML...
is that
More information about the Grace-core
mailing list