These are chat archives for jdubray/sam

18th
Jun 2017
Jean-Jacques Dubray
@jdubray
Jun 18 2017 02:26
Jean-Jacques Dubray
@jdubray
Jun 18 2017 02:32
@pel-daniel To be clear, I have nothing against pure functions, I am just trying to clarify the programming model people use, because a lot of what I hear seems to be based on Cargo Cults. As I said, there are three approximations that we have used that seem to be the problem:
  • actions can mutate state (of course that bears the question, what is an action?)
  • assignments are equivalent to state mutations
  • there is no need for defining a programming step, any line of code is a programming step (and anything can happen at any line of code)
I think we all agree by now that the programming model behing OOP has been a disaster which started around 1985-1989 with NeXTStep and SmallTalk (unfortunately I used NeXTStep and thought it was great).
I am just here to ask questions, I have no certainty (anymore). So one question is why FP code is much easier to write and understand? (I agree by the way).
Jean-Jacques Dubray
@jdubray
Jun 18 2017 02:39
But, I would like people to clarify how FP addresses these three approximations (if at all) and if there are better ways to address them. I would like people to demonstrate why a programming model based on pure functions is better than others.
If you have not read this article, I highly recommend it: https://www.microsoft.com/en-us/research/publication/computation-state-machines/
The general problem I see is that we are trying to supress state (and shared state), is that really reasonable? State is a problem, just write code like there is no state until you can't pretend anymore that there is no state. Is that really the best way to deal with (application) state?
Marcus Feitoza
@mfeitoza
Jun 18 2017 05:00
"Since functions and data structures are completely different types of animal it is fundamentally incorrect to lock them up in the same cage."
Jean-Jacques Dubray
@jdubray
Jun 18 2017 10:25
well, since closures are no different from classes, just a different syntax to achieve the same thing, I"d challenge that.
Slađan Ristić
@sladiri
Jun 18 2017 10:40

https://weex.apache.org/

Interesting, thanks :)

Jean-Jacques Dubray
@jdubray
Jun 18 2017 10:47
:+1:
@mfeitoza my theory is that there are four ingredients that are essential to any programming language: State, Type, Action and Relationship (STAR). Each programming language somehow support these four ingredients (otherwise it would not be able to write programs).
The problem is that we focus on programming languages, not the programming model, i.e. how these ingredients are expressed in the language and what relationship between them.
Jean-Jacques Dubray
@jdubray
Jun 18 2017 10:54
IMHO, FP looks refreshing to us, because it allows to write "actions" more easily than "types"
But we are still expressing (not supressing) STARs, there is just no way around it.
Jean-Jacques Dubray
@jdubray
Jun 18 2017 11:01
As you can see with SAM, a function is used for specific roles, so is a type, and in a specific order. Programming languages don't seem to be that prescriptive. WIth any programming language, it take experience, codified as patterns, to converge towards an efficient programming model. Elm seems to be departing from that tradition. In a way that's what's interesting about it.
My question is really, what is the best programming model (forget OOP, FP, RFP,...) and why.