5 ms·
Looked through source code [1]. It lacks readability and is worse than Rust. [1] https://github.com/froggey/Mezzano/blob/master/gui/desktop.lisp https://github
by codedokode 7y ago
Looked through source code [1]. It lacks readability and is worse than Rust.
[1] https://github.com/froggey/Mezzano/blob/master/gui/desktop.lisp https://github.com/froggey/Mezzano/blob/master/gui/desktop.l...
- phoe-krk 7y agoThe code looks readable to me - looks like usual Common Lisp code. Anything in particular that's unreadable? Disclosure: I'm a Lisp programmer.
- codedokode 7y agoToo many brackets and dashes. Arithmetic expressions look unfamiliar, and class declarations too. I am a PHP developer by the way. Also, I noticed a use of eval: (when (and unclicked-thing (eql unclicked-thing clicked-thing)) (let ((*package* (find-package :cl-user))) (eval (read-from-string (third unclicked-thing))))))))))) Also, some function names do not start with a verb, like "(defun desktop-main (desktop)".
- bobwaycott 7y agoIt seems you should learn more about Lisp—and how to read it—before criticizing it as unreadable. As it is, your comment simply reads as if you were saying, "French is unreadable because I only know English." Of course it is. So learn how to read the new language.
- aidenn0 7y agoFWIW, noun-verb ordering of functions is reasonably idiomatic in lisp, particularly when single-dispatch might be used in other languages. The usage of eval there makes sense because it is launching a program. It's equivalent to e.g. using system() or /bin/sh in a launcher on a unix system.
- jhomedall 7y agoDon't confuse unfamiliar with unreadable. There are a large number of languages that don't fall under the 'imperative, curly bracket' umbrella. For example: - https://docs.microsoft.com/en-us/dotnet/fsharp/tour#pipelines-and-composition https://docs.microsoft.com/en-us/dotnet/fsharp/tour#pipeline... - https://ocaml.org/learn/taste.html#Polymorphism-sorting-lists https://ocaml.org/learn/taste.html#Polymorphism-sorting-list... - http://wiki.c2.com/?ExampleForthCode http://wiki.c2.com/?ExampleForthCode - https://github.com/bryanjenningz/25-elm-examples/blob/master/24-filter-todos.elm https://github.com/bryanjenningz/25-elm-examples/blob/master... - https://github.com/marklnichols/haskell-examples/blob/master/src/Primes.hs https://github.com/marklnichols/haskell-examples/blob/master...
- phoe-krk 7y agoFYI, DEFUN is a verb in Lisp - DEfine FUNction.
- kazinator 7y agoThe eval here seems to be providing the feature of exposing Lisp evaluation to the end user via some UI field. It's not "I used eval because I don't know about apply or macros". How did this unreadable gobbledyook fail to conceal its use of eval from your eyes?
- kazinator 7y ago> some function names do not start with a verb defun is actually a complete sentence, contracted, as others have pointed out. Defining a function uses a noun-like keyword in some languages. For instance in, oh, Awk, the function keyword is used. There is a def prefix convention in Lisp, as well as a define- one: defmacro, defclass, defconstant, ... define-symbol-macro, define-setf-expansion. The def-s are contracted words with no dashes; the define-s are whole words joined by dashes. All the macros named this way have a some global defining effect, and are mainly used used as top-level forms: if you see one nested in code, then that's a red flag. Functions are often named verbs when they are not actually functions, but procedures: subroutines that have a side effect: print, put_pixel, sort, connect, ... Functions that calculate something from their arguments and return a value are often not named after verbs, but rather nouns. Even if you aren't familiar with functional programming, you probably know some pure functions in some languages. For instance, arithmetic ones: sin, sqrt, atan. Or how about accessors that retrieve the property or state of an object: length, position, temperature. All these are nouns. (Sometimes pure functions are verbed, after the process that they perform to calculate the return value, such as join, catenate. sort and reverse could be names pure functions that returns a sorted sequence, though reverse is also a noun (function that returns the reverse of its input)). Blind adherence to rules like "functions must start with verbs" is a symptom of cargo cult programming.
- lispm 7y agoDEFUN is not a function. It's a definition macro and stands for `DEFINE FUNCTION`. These defining macros are beginning by a style convention with DEF: DEFUN, DEFMACRO, DEFCLASS, DEFVAR, ...
- hibbelig 7y agoI think GP was complaining about desktop-main, not about defun.
- lispm 7y agothanks, seeing that now... But that's not unusual in Lisp, as functions may be seen as objects, getters, formulas, etc.. For example a function maybe a top level loop. Then I might call it TOP-LEVEL-LOOP and not run-top-level-loop or similar.
- SomeHacker44 7y agoWhile it lacks the level of comments and docstrings that I typically use (a ton), it seems at first glance like reasonably structured imperative style CL.
- reikonomusha 7y agoAs a professional Lisp programmer, this is quite readable and well-structured. Lacking in comments and documentation, but I was able to infer things well enough.
- jhomedall 7y agoI've only ever dabbled in Lisp, but that seems perfectly readable.
- danbolt 7y agoI haven't really used either Lisp or Rust much, but I didn't find the code too bad. Given, everything seems quite well-named here, and that helps a ton.
- dang 7y ago"Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something." https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html
- varjag 7y agoYou are incorrect, the code is pretty solid.