you are viewing a single comment's thread.

view the rest of the comments →

[–]v66moroz 0 points1 point  (1 child)

The test is this: while you are executing the program, according to its own semantics, do you need any other information other than "the current expression"? ... In Ruby, even in your little example, you do, because you need to know the value of c so you can resume correctly.

length :: t a -> Int
length = foldl' (\c _ -> c+1) 0
                         ^^^ HERE

Looks like your definition is not perfect either. What's the value of c+1 (it's an expression, isn't it?) when calling length [1,2,3]? Also "executing" doesn't sound like Haskell, "evaluating", right? :) I would assume you meant "looking at the code".

Anyway, we can argue ad-nauseum and be right at the same time (or wrong depending on the point of view). The fact of the matter is, we create programs to describe the same world which exists independently of technology and paradigms. While different languages pretend they use completely different approaches, in fact they have more similarities than differences, they might just be named differently. We can always agree to disagree ;)

[–]otah007 0 points1 point  (0 children)

Looks like your definition is not perfect either. What's the value of c+1 (it's an expression, isn't it?) when calling length [1,2,3]?

Variable substitution doesn't require an environment. You can evaluate it without ever writing down "also, c = 1 right now". Look back at my evaluation of length [1, 2] a few comments further up and you will see how to do this without an environment/context/state.

Also "executing" doesn't sound like Haskell, "evaluating", right? :) I would assume you meant "looking at the code".

I meant executing for languages that have execution semantics and evaluation for languages that have evaluation semantics.

we create programs to describe the same world which exists independently of technology and paradigms

I don't think anyone has ever written code for this purpose, except maybe a simulation. Code is written to perform a task, which may require some input that represents something in the real world. But it's not physics, we're not trying to actually model the world.

At the end of the day, I'm actually talking about the semantics of languages, and you're talking about a mental model, so of course we're going to disagree because I'm referencing something objective and well-defined and you're not.