Hacker News new | ask | show | jobs
by caditinpiscinam 2254 days ago
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.
3 comments

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.
thanks for the response!

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.