HackerTrans
TopNewTrendsCommentsPastAskShowJobs

hacker_9

no profile record

comments

hacker_9
·7 yıl önce·discuss
Modern Javascript is complicated*. Elm Lang on the other hand is great for web dev.
hacker_9
·11 yıl önce·discuss
I agree that the shape of the code is what I start with too: the syntax-highlighted keywords stick out as anchor points when scrolling, and I know from indentation where sections start and end.

Example:

  if (...)
  {
     ...
  }
  else
  { 
     ...
  }
or

  loop
  {
     ...
  }
After I home in on the words then yes I will generally read left to right, top to bottom. But another part of imperative style is code is usually split into separate paragraphs of related functionality - so I can usually jump down whole paragraphs too.

The only other obvious variation I can think of is I will read bottom up when tracing the path a variable took to get to where I am currently looking.
hacker_9
·11 yıl önce·discuss
Many languages do follow a similar syntax though, that do relate to how plain english is written. I personally started with C#, and when I look at other languages I don't find them very hard to follow because they also follow the same basic 'read left to right' rule. Even coming across data formats such as html/xml for the first time are easy to follow because of the left to right reading.

In your example, the 2nd one is actually what I'd prefer to read as I know that it will be compiled down to 5 ADD assembly instructions, whereas the first looks like it will be turned into a function call that will then initiate a loop. I'm guessing/hoping Lisp optimises the (+) function though so probably a null argument from me. See my reply to nnq for a better example.
hacker_9
·11 yıl önce·discuss
I have read through Paul Grahams essays a few times and do respect his opinion, but I just can't see it myself.

The parenthesis are actually the least bit I have a problem with (as the indentation generally makes flow clear). But the actual function within a function with a function syntax and so on just seems to me to hinder the reading of the code and thus the understanding, maintenance and modification of it.
hacker_9
·11 yıl önce·discuss
I agree I am a verbal thinker, but that is only because I have to read the words off the screen to begin with - once I have the english in my head my mind switches between verbal and visual images to figure out the next part to write/how to fix the bug etc.

Anyway to take an example from your github:

> if (and form-method (= request-method :post))

am I right in saying this is pseudo-imperative:

if (form-method && (request-method == 'post'))

To me the ability to read it left to right seems like a huge win. With the lisp version I seem to be holding the program in my head until the very last (= ...) just so I can work it all out. Perhaps that is just in-experience though.
hacker_9
·11 yıl önce·discuss
> Why Lisp? Again > It is awesome.

Why do people who write or talk about Lisp always have to start with something like this? To be honest I still can't see the appeal of Lisp. Yes everything is a function so you can add/remove 'language features' as you want, and the syntax is really simple, and code is data (a rare need of mine anyway). But Lisp sacrifices the most important thing of all; readability.

Everyone tries to read programming languages as close as possible to plain english in their head, but Lisp goes completely against this and makes you write things like (* 1 (+ 2 (/ 3 4))) where you have to glance back and forth to even understand the equation - is 1 * (2 + 3/4) not easier to read? Even in C# the phrase 'if (!(foo is bar))' annoys me because it reads 'if not foo is bar' when I'd like to say 'if foo is not bar'! So I think me and Lisp have no hope.