
Pointless - hsartoris
https://ptls.dev/
======
ecnahc515
This is pretty cool. After reading half the examples, I started wondering
"wait what are you doing with the output variable", and then it clicked and I
checked the docs, and yep, outputting to stdout is done by assignment to a
magic `output` variable. A very interesting/novel approach to things.

~~~
kazinator
Classic BASIC implementation picked up on this idea. For instance some
dialects had an _INKEY$_ variable which looks like a string, but magically
reads console input.

GNU Bash has a magic variable _RANDOM_ that produces random numbers.
Assignments to it appear to be ignored.

In Algol, the name of the enclosing function acts as a variable to which you
assign in order to produce the return value. For instance, see the assignment
to B in the nested function here;

[https://en.wikipedia.org/wiki/Man_or_boy_test](https://en.wikipedia.org/wiki/Man_or_boy_test)

~~~
JNRowe
> GNU Bash has a magic variable RANDOM that produces random numbers.
> Assignments to it appear to be ignored.

Assignments are used to seed¹ the random number generator². This isn't limited
to just bash/zsh/etc, it is intrinsic to the process of generating random
numbers. Being aware of this is useful as it poses a significant footgun. The
/dev/random docs³ provide a nice overview of how it is often handled on
various systems at the OS level to deal with reboots.

An example of the fun that this can produce can be seen in a Debian bug⁴,
running a script that uses subshells and RANDOM with bash will behave very
differently when using zsh. In this instance you have to hope that subshells
aren't being used to create unique logs as an example.

1\.
[https://en.m.wikipedia.org/wiki/Random_seed](https://en.m.wikipedia.org/wiki/Random_seed)

2\.
[https://en.m.wikipedia.org/wiki/Random_number_generator](https://en.m.wikipedia.org/wiki/Random_number_generator)

3\.
[https://en.m.wikipedia.org/wiki//dev/random](https://en.m.wikipedia.org/wiki//dev/random)

4\. [https://bugs.debian.org/cgi-
bin/bugreport.cgi?bug=828180](https://bugs.debian.org/cgi-
bin/bugreport.cgi?bug=828180)

------
tutfbhuf
Reminds me of LiveScript. Nowadays, you might be able to achieve something
similar with JS + a bunch of Babel plugins, like pipeline operator and so.

~~~
cprecioso
Yes! LiveScript was so fun! I’m pretty sad none of the JS dialects from that
time (CoffeeScript, ICS, Coco, LiveScript...) could hold a candle for how much
TypeScript improves the experience; or that none could integrate it in a
sensible fashion.

------
alricb
I see shades of Oz [1], but that might just be my imagination.

[1]: [http://mozart2.org/](http://mozart2.org/)

------
ledauphin
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.

~~~
caditinpiscinam
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.

~~~
smichel17
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
      }

~~~
caditinpiscinam
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

~~~
rurban
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.

------
knowyourleadcom
These are some very clean examples. they pretty much read like piping commands
and would be a good tool for teaching one or the other at the same time to
someone new to both.

------
tromp
Wondering how pointless differed from Haskell, I looked up the syntax for
composition and found

    
    
      compose(a, b) = x => a(b(x))
    

It's indeed more pointless than Haskell:-)

Btw, the `x' in that definition is the `point' from which the name originates.

------
dang
I guess I'll be the first to mention how clever the name is.

~~~
imslavko
Could you elaborate? I thought the name was a reference to a "point-free
style" of piping commands. But maybe I am missing something more obvious?

~~~
dang
Right, point-free style is a classic of functional programming, so to pick
"Pointless" for a FP language is nice. One of those obvious-once-you-see-it
things.

------
gameswithgo
looks a lot like f#

------
rurban
Who else has otherwise instead of else? I don't get that

------
Iwan-Zotow
f# and .fsx/fsi scripting

~~~
caditinpiscinam
I'm not super familiar with f#, but Pointless definitely takes inspiration
from languages in the ML family, while only offering a small subset of their
features. One of the questions I want to explore in this project is how
programming language design can shape the learning process for beginners,
centering on the idea that the features that a language chooses not to include
are often key. I was pretty influenced by Mark Seemann's essay [0] on this
idea.

[0] [https://blog.ploeh.dk/2015/04/13/less-is-more-language-
featu...](https://blog.ploeh.dk/2015/04/13/less-is-more-language-features/)

