TIL OCaml has .mli files which are much like .h files in C: they define (and enforce) a public interface.
This seems to be less popular in newer languages: we tend to prefer public/private annotations in a single file. I'm not sure why this changed.
miniblog.
Fun article discussing the early development of autocorrect, blacklisting unwanted words and working out what to correct: https://www.wired.com/2014/07/history-of-autocorrect/
(Also contains this remarkable comment: "As someone who typed the entire first draft of his book on a phone...")
Adding dragon emoji as semicolons in node.js or the typescript compiler: https://blog.angularindepth.com/instead-of-semicolons-what-if-you-could-code-with-dragons-df5d0a4ef4ee
Nice post showing that working with programming language implementations need not be scary!
Syntactic Closures by Bawden amd Rees: https://www.dtic.mil/cgi-bin/GetTRDoc?Location=U2&doc=GetTRDoc.pdf&AD=ADA195921
This 1988 paper explores an alternative Scheme macro system before hygienic macros were standardised.
Visual augmentation of source code editors: A systematic review https://arxiv.org/abs/1804.02074
A useful paper categorising all the different ways IDEs can show additional metadata alongside the code.
For example, they show this cute plugin (Clepsydra) that shows worst case runtime.
GitHub has made a considerable effort to let users hide their email addresses: https://help.github.com/articles/about-commit-email-addresses/
I totally understand that users find this desirable, but it's awkward to implement on top of git. GH provide a hook to prevent mistakes: https://help.github.com/articles/blocking-command-line-pushes-that-expose-your-personal-email-address/
A fun quiz on eval() in JS, and corner cases of its behaviour: https://blog.brownplt.org/2012/10/21/js-eval.html
I've seen some of the gotchas before, but I still don't envy JS implementors.
How do you bootstrap a trusted computing base? I suspect you'd want a C compiler that was small enough that you could read the entire disassembly and verify that it worked as expected. That seems intractable.
There's an awkward tension between auto-update and fixing security bugs. If platforms don't automatically update, users don't get security fixes. If they do update, you're giving the vendor RCE power.
Perl is still very much a glue language, even in areas that are largely statically typed. Haskell's GHC depends on it, OCaml's opam uses it, and Nix had a perl dependency until last year too!
Another interesting aspect of OCaml syntax:
[1,2,3] is equivalent to [(1,2,3)]. A list of integers is [1;2;3].
This is one of those cases where familiarity with the syntax of other languages can actually make life harder! [1,2,3] doesn't look wrong and is syntactically valid.
Does a canonical hello world program output "Hello, World!" or just "hello world"?
I've always favoured the latter (less typing when learning a new language) but the former seems pretty common.
I'm learning OCaml at the moment, and I was caught out by the syntax today. This code (pictured) gives a type error saying that Sad is not a boolean. https://gist.github.com/Wilfred/ce4b7177f404a482b8fccc0044d15e4c
This is the classic 'dangling else' syntax problem, but with match statements rather than if statements.
Some Lisps can be both interpreted and compiled, which allows some lovely workflows.
You can iteratively evaluate code snippets, and only compile when you're happy with your new feature! This takes the compiler out of the iteration cycle, so you get feedback sooner.
Python is criticised for the GIL preventing multiple threads running at once. Turns out that many languages don't support this kind of parallelism, including JS, PHP/Hack and OCaml (although multicore-ocaml is underway).
Another neat OCaml feature: the type of a partially applied printf call reflects the format string used! Not many statically typed languages have this property.
Emacs' support for OCaml is exceptionally good. Not only does tuareg-mode have a decent REPL integration, but it even has thorough 'pair' highlighting for keywords!
Even more impressively, merlin-eldoc understands scope and shadowing when highlighting symbols!
Fun post on the lessons learnt when implementing a JIT VM for a language: https://www.mikedrivendevelopment.com/2018/06/what-i-learned-making-my-own-jit.html
Evaluate snippets of Clojure with the bindings set up as if you'd called the function. This neat idea was proposed in https://blog.cognitect.com/blog/2017/6/5/repl-debugging-no-stacktrace-required and https://github.com/vvvvalvalval/scope-capture builds tooling to automate it!
OCaml's syntax is interesting: there are very few characters different between variable and function declarations:
let foo = bar 123
vs
let foo x = bar x
Taking the idea of a lisp-1 to even the syntax!
Showing 2,661-2,680 of 7,508 posts