5 ms·
The main issue I have with CLs type checking is the clunky syntax and the fact that it looks different in different contexts. I made an attempt to fix that for
by codr7 1y ago
The main issue I have with CLs type checking is the clunky syntax and the fact that it looks different in different contexts.
I made an attempt to fix that for eli:
https://github.com/codr7/eli#type-checking https://github.com/codr7/eli#type-checking
- rjsw 1y agoYour eli looks clunky to me.
- codr7 1y agoWell, use something else. And maybe ask yourself why you felt saying so was important to you.
- dokyun 1y ago(the number (+ 35 7)) is a lot less clunky than (+ 35 7)@Numeric
- codr7 1y agoThat's your opinion, I don't agree. And the other reason is I can use the same syntax wherever I want type checking.
- epgui 1y agoOpinions aside, it is objectively an increase in syntactical complexity, and many people who love lisp enjoy its relative syntactical simplicity. Whatever is gained in exchange for this additional syntactical complexity may not be valued in the same way by everyone. So that almost certainly explains that reaction.
- codr7 1y agoYes, and a lot of people recognize the value of having a little bit of syntax in their Lisp.
- klibertp 1y agoYup. Somehow, I prefer[1]: (funcall #~s:gi/abc/def/ "Testing abc testing abc") to the five lines of the equivalent made with macros, function calls, and keyword arguments. I know all the problems with reader extensions, really. I understand being cautious. But at some point, you gotta wonder: what's the point of the programmable reader when you're unwilling to add programs to it? [1] Let over Lambda: https://letoverlambda.com/index.cl/guest/chap4.html https://letoverlambda.com/index.cl/guest/chap4.html
- kazinator 1y agoI'm reasonably happy with: 1> (regsub #/abc/ "def" "Testing abc testing abc") "Testing def testing def"
- HexDecOctBin 1y agoOne problem with Lisp is everything, including variable bindings, increases the nesting level making the code illegible. Last thing you want is for the type declaration to have their own nesting.
- zarathustreal 1y agoThis is not necessarily true, you can pretty easily implement just about any syntax you want
- dokyun 1y agoIf you hate nesting, just do this (defun foo (&aux bar baz) (setq bar (quux) baz (xyzzy)) ...)
- epgui 1y agoThe nesting level doesn’t necessarily impair legibility, it depends how it’s done. Nesting levels in homoiconic & referentially transparent languages have an impact more comparable to nesting levels in yaml or json than nesting levels in a language like python or javascript. The tradeoff weighs in a completely different way. First you will usually want to write small chunks of code, instead of a large soup. Second, you can make intentional decisions with your use of newlines in order to highlight specific aspects of the code. I find clojure more readable than most other languages… However, bad code stands out horribly (which is actually great if you have at least one experienced engineer in the team- I’d argue there’s nothing worse than bad code that looks normal). Just like anything else, writing good lisp takes some skill. Your specific editor and its configuration will also have a big impact on your experience.
- sdsd 1y agoYou'd love threading macros in Racket: https://docs.racket-lang.org/threading/index.html https://docs.racket-lang.org/threading/index.html It's like Unix pipes for functions: (~> "hello" (string-ref 1) (char->integer))
- klibertp 1y ago
- deleted 1y ago[deleted]
- recursivecaveat 1y agoAre those compile-time type checks or runtime assertions?
- codr7 1y agoMix, similar to CL but slightly more runtime atm.
- norman784 1y agoI don't particularly like the syntax for the types, but I can't also think of a better way to implement it without adding a special case in the parser/compiler for it, right now with your syntax I believe, correct me if I'm wrong, it can be implemented with a macro in any Lisp