This is a good point, but there's also a key difference.
There's a big difference between "code being in one file" and "code being in one function." It sounds like the OP had something reasonably close to "one function," whereas the HN code has a lot of (what appear to be) small well designed methods.
I'm not seeing the irony. The file you linked to is only ~2600 lines of code and seems to be well-modularized and fairly well commented. Assuming that's the whole site, I think that's pretty reasonable.
The only readability issue I have with that is the functions expected arguments. Add some types and I’d be very happy to work on it. I believe Facebook uses a single directory of files now as best practice? With the file names including namespaces. That was an HN comment from ages ago so could be wrong or misinterpreted.
I've been implementing it for a couple years now, though not seriously till the past couple months. There are some interesting (and overlooked) ideas in Bel.
Bel is sort of the limit case of generality. For example, you might expect the "type" above to be a separate kind of object, the way that types are separate kinds of things in TypeScript.
But in fact, it's simply a function that receives the argument and can throw an error. So for example, you can do something like:
I just wish he'd solved keyword arguments as thoroughly as every other kind of argument. There are hints that it was always in the back of his mind. Though it's true he never needed them, so that's probably why he never made them.
Well, you can interpret the predicate function body as a set of constraints on the type. Of course, such predicate function would need to be restricted to what your type system can handle. Typed Racket does this, by allowing you to implement type refinements[1]. As long as the predicate only uses operations listed there, it can be used for type checking. Idris also lets you write functions that operate on types and that are used for type checking.
This is amazing. Is there a syntax highlighting and linter kind of things for the "Arc" language? If it's possible, I would like to try that. I love how Lisp looks like.
Which IDE do you like? I'll see about getting some highlighting for it.
As for actually running arc, it’s hard to run the original arc3.1 due to racket updates. I’ve made a few branches over the years that try to preserve the original spirit of arc (no significant changes) while making it easy to run. Try this one:
I believe you can simply install racket, then run make && bin/arc and be dropped into a repl. From there you can follow the arc tutorial, whose link I’ll dig up after I’m finished driving home.
EDIT: That fork is actually a lot different from arc3.1 proper. I’ll try to locate a more faithful one.
EDIT 2: Unfortunately it's quite a lot of work to remove the mzscheme dependency from the old arc3.1 codebase. And I'm not sure it's even possible to install the mzscheme lib on the latest racket (e.g. `brew install racket` doesn't seem to have it).
So the above instructions are the best I can do for now.
I use Visual studio code, I couldn't find it in Extensions. I'm just asking out of curiosity, What do you develop with Arc usually?
I like how the "html" and "css" part was embedded in that "news.arc" file. Do you think that VIM script will highlight and lint the "css" part of an "arc" file?
Nowadays I've been trying to implement Bel, mostly for the challenge of it than for any practical reason.
> I like how the "html" and "css" part was embedded in that "news.arc" file. Do you think that VIM script will highlight and lint the "css" part of an "arc" file?
It's probably hard to tell, but the "@(hexrep border-color*)" would normally be highlighted as if it were a string. Arc has a feature called atstrings, where you can use @foo to reference the enclosing variable "foo". It can also call functions, e.g. "The value of 1 plus 2 is @(+ 1 2)" will become "The value of 1 plus 2 is 3".
(HN has indentation, though.)
It’s important to realize that this is good design. It’s hard to separate yourself from the time you live in, but the rewards are worthwhile.