Open kjx opened 8 years ago
I don't see any need for sort. My intro students will never see PrimitiveArray, only List. I see we need it (e.g., in data structures to show what is going on under the hood), but it should not contain anything substantive.
All methods from #49, plus:
at()
at()put()
size()
sortInitial()by()
Sort is there for pragmatic reasons. We do need sort on lists, sequences, etc. If we implement sort in Grace, it will always run 10 or 100 times more slowly than anything implemented by the underlying platform.
So, rather than writing Quicksort in Grace, I chose to expose the underlying sorts from C and JavaScript. I think that this is a reasonable approach for other implementations too. Kernan could expose C#'s sort.
We need a naming scheme for this. Something like an object primitive
with attributes memory
, identity
, ...
I suggest that primitive
be used for things that are defined as part of the language, and platform
for things that are platform-dependent.
we're supposed to have such a scheme, not sure where it is documented, but we did agree on it, and that the prefix for this was "platform"
note that for object capability security reasons, this should be in many small modules "platform/memory" and "platform/timing" and "platform/rats" or whatever --- rather than just one big module object with lots of sub-objects.
PrimitiveArray is now in the standard. If anyone cares about naming schemes, I guess we can open another issue.
I think that primitiveArray
needs to be in the language spec, not in the Standard library document. It's something that a language implementation needs to provide, in order that one can write the libraries.
Moreover, it should be capitalized that way.
On 11/06/2016, at 3:27AM, Andrew Black notifications@github.com wrote:
I think that primitiveArray needs to be in the language spec, not in the Standard library document.
Why? The full protocol for String & Integer is in the standard prelude doc, not the main language...
It's something that a language implementation needs to provide, in order that one can write the libraries.
that's a separate question. it's imported, right, so why put it in the core? reflection also has to be "built in" to an impl, do we put that in the language?
Presumably this needs to confirm to #49 How do we decide what the interface should be. In particular, should it really have sort? I note neither implementation has hash.
spec
doesn't really say
amg
Kernan