79 points · by panic · 9y ago · 31 comments
One drawback, though, is that you couldn't use it for arbitrary data. The strings seem to be mapped to C strings, so variables can't contain nulls. No way to express a null in a string literal, either.
Edit: antirez (redis creator) also made a tiny tcl interpreter...actually a little smaller than Partcl. Has the same issues with null chars: http://oldblog.antirez.com/post/picol.html
Base64 wouldn't help much dealing with existing binary files, for example. Or network protocols, or unicode, and so forth.
This would push the line count over 600, but I bet it would still come in at less than a nice round 1,000, while making the thing a lot more useful.
(I have a side project that's starting to feel like it might need a scripting language. And I always liked tcl. Must... resist... rabbit holes...)
No offense unitypers, maybe your typing systems have valid use-cases, I'm not sure. I'd like you to convince me if possible.
EDIT: Using slightly less off-putting language. I truly welcome arguments, even sound opinions.
Could you explain this? I'm not aware of such a thing at all?
> maybe your typing systems have valid use-cases,
I'd like to ask before I start explaining, what is your current level of knowledge on different kinds of dynamically typed languages? It's hard to say from your comment alone[1]. Have you ever worked with a Smalltalk or Lisp live environments? Have you ever used Assembly or Forth? Are you aware of Erlang's Dialyzer or Racket support for contracts?
There are many ways to do dynamic typing, and they vary widely in both their aims and methods. It's important to note, however, that most dynamic type systems arise from a severe failure of static typing. As long as there are useful programs which would be rejected by a type checker dynamic typing will remain in use.
[1] I'm trying really hard to apply 'principle of charity' here.
I have only used a JS live environment (the browser console) but I hope you have in mind something that my static language's debugger cannot do. I assume the next two languages are about reflection - I've done some. Finally, I'm unfamiliar with the Erlang's static analysis tool and I don't know Racket's contracts, but I'd like you to tell me how they differ and why you think they're better than my own.
Around 2005 - 2010 there was a massive amount of proselytism on the internet in favour of dynamic languages. The likes of Steve Yegge, DHH, Zed Shaw, Mark Pilgrim, Why the Lucky Stiff, Paul Graham (with lisp) and others were constantly pushing new blog posts, articles, books about the merits of dynamic languages and new teaching material and if you were to read HN or reddit from those years you'd think it was the end of statically typed languages. You couldn't spend a day without seeing things like Ruby on Rails pop up on slashdot and other media.
Fast forward to today :
All the new languages that have gained internet fame in the past years are static. Go, Rust, Typescript, Dart. People still use lots of Java and C#. Meanwhile big companies like Dropbox are abandoning languages like Python. New projects are written in Go despite being the company that employs Guido van Rossum. Nobody talks about Google caring about python anymore either. The dynamic typing "rockstar programmers" have all but disappeared from the internet and stopped blogging/writing articles/writing books, with only one exception, Zed Shaw. The rest have either completely erased their internet presence or just become utterly silent.
There really is a moment on the internet that could be described as the dynamic bubble. Although I'd say, "dynamic echochamber" is more accurate.
― Terry Pratchett, The Truth
I probably shouldn't have used the word bubble, sorry. See my response to klibertp for hopefully some justification.
For an example of a respected academic discussing dynamic typing properly, recognizing it to be typing, see Henry Baker's paper The Nimble Type Inferencer for Common Lisp.
https://news.ycombinator.com/item?id=13616965
In dynamically typed code, it is often possible to logically infer the type without executing it, so that the same information which is known at run-time can be ascribed to nodes of the syntax.
These are not two different type systems; it's the same information, just known at different times to some degree of completeness.
Quote from the paper:
We have chosen to perform static type inference on programs in the dynamically-typed Common Lisp programming language [CLtL84]. Common Lisp-84 has a reasonably complex type system. This system involves 42 simple type specifiers, 4 standard type operators, and 21 type specialization forms. Common Lisp has the usual primitive integer and floating point types, characters, the traditional atoms and conses of Lisp, vectors, arrays, and strings. In addition, Common Lisp has a host of non-traditional datatypes, such as hash tables, readtables, and other special purpose types. The datatype system can also be extended through user-defined structures, which are analogous to structures in C and to records in Pascal and Ada.
No nonsense here about Common Lisp having just one type, the value cell.
It’s just markedly more useful to me to have that information available statically. I like being able to modify code with the assurance that the compiler will tell me about all inconsistencies. I like that the compiler can prove that its automated transformations are correct. Of course, maybe that says more about the way I work than type systems themselves.