
Tulip – An untyped functional language - jneen
http://www.jneen.net/posts/2015-03-01-tulip-language
======
_pmf_
This might seem strange, but if there's one thing from Common Lisp that should
receive wider adoption in other languages, it's hyphenated names. They are so
much more readable than anything else (well, C with underscores comes close).

~~~
thomasfoster96
I've been playing around with creating a toy language which treats '-' as a
name for a function. It means there always needs to be white space around a -
(the syntax of the language isn't like LISP), but that increases readability
at the cost of two extra key presses.

~~~
kazinator
Also, note that, in the same breath practically, you can support true negative
integer constants:

    
    
       -1234
    

which are distinguished because there is no whitespace. You can distinguish
the unary operator being applied to 1234 from a true -1234 constant.

------
otabdeveloper
If that sort of thing interests you, also check out my language 'tab'
([https://bitbucket.org/tkatchev/tab](https://bitbucket.org/tkatchev/tab)).

Tab is a statically-typed, functional, type-inferred language that occupies a
niche between bash and python.

It's also not Turing-complete but can compute almost everything you could ever
think of.

(I wish more languages aimed for Turing-incompleteness -- unsurprisingly, it
turns out Turing-incomplete languages have big benefits for performance and
resource management.)

~~~
g8gggu89
How is yours not Turing-complete and what benefits are there?

------
lectrick
> I strongly dislike macros that can hide in code. I get really frustrated
> when I open a source file and see (foo ...) and can’t tell whether it’s a
> function or a macro until I read documentation.

Well... that's just, like, your opinion, man.

Seriously though. In Elixir, for example, much of the language itself is
implemented via its own macros, which demonstrates a certain nice
extensibility. If Elixir followed this same pattern, it would get really
annoying really quickly, as even simple if statements would require a leading
slash.

Also, I preferred "unf" ;)

~~~
jneen
Yep, it's my opinion, and that's why I put it into the design. Lots of
language design comes from opinions. I hope it's borne out. FWIW it's the same
approach Rust has taken, where macros have to end with a ! to make them
visually distinct.

~~~
lectrick
That might be because Rust might not eat its own dogfood in that department,
and build some of its own functionality out of its macro system.

But I can see just "knowing" at a glance if it's a macro or not.

I think the answer would basically be determined by how much of the language
itself uses its own macro system AND what type of macro system it actually is.
If it's significant, having special syntax would just look weird.

~~~
kibwen
Rust does eat its own dogfood with regard to macros, and over time has
steadily replaced former language-level features like `log` and `panic` with
macros. Syntactic distinction is a philosophical choice in service of making
costs more explicit (and while it's true that functions can hide behavior,
overuse of macros can trigger enormous code bloat, such as the `regex!` macro
which compiles your regex into a state machine).

(There are also valid technical reasons for requiring syntactic distinction,
as the sheer flexibility of Rust's macros in their ability to create new
syntax run the risk of making it a nightmare to parse if you remove the
unambiguous ability of the compiler to drop into macro-parsing mode. These
challenges aren't insurmountable, just very hairy.)

------
giancarlostoro
Link is down for me.

Google Cache Text-Only:

[http://webcache.googleusercontent.com/search?q=cache:cOp3ebJ...](http://webcache.googleusercontent.com/search?q=cache:cOp3ebJoVLEJ:www.jneen.net/posts/2015-03-01-tulip-
language&client=ubuntu&hl=en&gl=us&strip=1)

~~~
jneen
Argh, thanks for the cache link. I'm still on heroku free-tier :\

------
chubot
This looks cool -- is there any source code? What language is it written in?

"Tulip is still in active development, and I could use a whole lot of help,
both filling in the design gaps here and actually churning out the
implementation"

~~~
klibertp
[https://github.com/jneen/tulip](https://github.com/jneen/tulip)

~~~
chubot
OK interesting, it actually appears to be written in RPython, not full Python:

[https://github.com/jneen/tulip/blob/master/tulip/libedit.py](https://github.com/jneen/tulip/blob/master/tulip/libedit.py)

(RPython is the "static" subset of Python used to bootstrap PyPy)

~~~
maxerickson
They have moved towards treating RPython as a framework:

[http://rpython.readthedocs.org/](http://rpython.readthedocs.org/)

~~~
jneen
Yeah, it's basically a toolkit for building jitted languages. Basically the
easiest way to get a tracing jit these days. So it'll be a self-hosting jit
similar to pypy or pixie.

------
duaneb
Note that it definitely has types, they just aren't required explicitly. It
seems to use dynamic type matching.

~~~
namanbharadwaj
It's unityped! It has one type with infinitely many variants/tags (.<string>).
Match failure occurs at runtime as in any other safe typed language such as
Haskell or ML.

~~~
wyager
>Match failure occurs at runtime as in any other safe typed language such as
Haskell or ML.

That is incredibly disingenuous. The only way a Haskell or ML program could be
as colossally unsafe as a unityped language program is if the programmer used
only one giant sum type for the entire program, and most functions in the
program were non-total with respect to that type.

"Unityping" provides no static type safety. It is isomorphic to, and usually a
euphemism for, the lack of any static type system.

~~~
jneen
Yeah, it was a difficult decision to remove types - I'd gotten myself into a
corner trying to tack on dependent types, and it just wasn't happening. My bet
is that unlike most of the un{i,}typed languages out there (most of which I'd
categorize as lisps and smalltalks), tulip provides tagging and destructuring
that allows the programmer to maintain some level of control over the
polymorphism. Tulip will panic at runtime for non-total functions, but ideally
you'll have the tools necessary to keep the panic as close to the problem as
possible.

------
wyager
"I’ve renamed the language from Unf to Tulip, because some folks pointed out
that the old name created an unnecessarily sexualized environment"

Are fifth graders critiquing programming languages now? Seriously, who makes
that association and then feels the need to comment on it?

~~~
evincarofautumn
“Unf” is quite widely used as a spelling of a moan, to express sexual desire
or gratification. While it _can_ be used to express non-sexual enjoyment, the
sexual connotation it evokes is just unnecessary when it comes to a
programming language, regardless of the original intent.

~~~
a_c_s
While I've never seen this use personally, UrbanDictionary very strongly
corroborates this.

[http://www.urbandictionary.com/define.php?term=unf](http://www.urbandictionary.com/define.php?term=unf)

~~~
evincarofautumn
It’s worth noting that “universal noise of fucking” is a backronym—the word
was originally onomatopoeic.

~~~
TazeTSchnitzel
It is, still, but urbandictionary users like making inaccurate definitions as
an attempt at "humour"

