You are viewing a single thread.
View all comments View context
2 points

So, writing stateless functions, or working in declarative languages doesn’t count?

permalink
report
parent
reply
3 points

Stateless functions still deal with state, they just don’t hold onto it. Without state to mutate, a so-called stateless function doesn’t do anything.

In declarative languages, your state is the sum of everything you’ve declared. You don’t query results out of thin air. Computational results logically conclude from everything you set up.

HTML ““has state””, as in it has a DOM, but it doesn’t do anything with it. You don’t mutate the DOM after it’s built, or query the DOM to compute results that weren’t trivially evident from the state you declared.

You can do those things with JavaScript. But all that proves is JavaScript is a programming language, and HTML is just a data format it can interact with.

permalink
report
parent
reply
1 point

Programming is the art of juggling of state and control flow

Sure, stateless functions deal with and impact state in some way. If that’s what you meant by your previous comment, that’s fine, but that’s honestly not what would typically be meant by “juggling” state.

The part about declarative languages has nothing to do with state. Declarative languages do not give the programmer control over flow, the other part of your definition.

Learn Lisp, and you will never again be so certain about the difference between a programming language and a data format.

permalink
report
parent
reply
1 point

There’s no such thing as a pure functional language. All it would accomplish is warming the CPU up. All such languages store data away at some point.

permalink
report
parent
reply
1 point

I didn’t say there is…

permalink
report
parent
reply
1 point

Your statement implies it. Having stateless or declarative functions that never store or retrieve data would mean they are pure functions.

permalink
report
parent
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 6.9K

    Monthly active users

  • 1.5K

    Posts

  • 34K

    Comments