How would you describe the difference between an Object and a Map in Pointless?
Having read the documentation, I don't see any difference other than whether non-string keys are allowed, and as a result the syntax for value access (`obj.key` vs `map["key"]`).
And one of the things I've been wondering about with regard to language design is why more languages don't take a Clojure-like approach of fully merging the concept of "object" and "map", since they seem to cover so much of the same ground.
Hello, I'm the author of this project: Pointless originally had a static type-system, which I later ditched (the type-system was pretty experimental, and I never got it working to my liking). So the object / map division is a holdover from that. I'll probably keep them separate for now to leave the option of static typing open, but I agree that it's a bit redundant for now. The only remaining technical differences are that maps can have other types like numbers and labels as keys, and objects can include function definitions.
It would be worth actually including that information about your type system in the docs. There's no mention of the language being statically or dynamically typed - which is a shame, because a scripting language with a static type system from the get-go would be novel in itself.
Stray thought while reading the documentation, inspired by how easy it is to convert a variable to a function: is there any reason to include a separate switch statement at all? It seems like you could use `if` there with a similar syntax:
getSignZero(n) = if {
n > 0 then Positive
n < 0 then Negative
else Zero
}
Similar story as with objects - the switch statement originally existed to facilitate type-aware conditionals for statically checked algebraic data-types. At this point it's just syntactic sugar for a chain of conditionals. It might make sense to unify the two constructs - and I like the syntax you suggest
Or cond. Which is more like what you did. Not if, which is everywhere a binop. switch takes a block with seperate syntax, but cond just a list of expressions and statements.
to follow up on this, does this mean that Pointless actually allows inheritance and polymorphic dispatch? Because clearly functions are first class, so they could easily be values in a map just like they could live in an object.
Possibly because JS did that (it has been a thing since Self I think? Or maybe that was just the prototypal inheritance—I never can remember) and the confusion between the symbolic properties and the key properties kept coming up. Like, you have that x.abc is the same as x["abc"] but then things start to break because many dict objects have a .__proto__ or whatever and so they start to fail in interesting ways when you allow users to store their own strings in the keys and they overwrite something you were using later on.
JS now has a dedicated Map type to work as a proper dictionary.
Having read the documentation, I don't see any difference other than whether non-string keys are allowed, and as a result the syntax for value access (`obj.key` vs `map["key"]`).
And one of the things I've been wondering about with regard to language design is why more languages don't take a Clojure-like approach of fully merging the concept of "object" and "map", since they seem to cover so much of the same ground.