Fork me on GitHub
#off-topic
<
2017-06-26
>
dpsutton12:06:00

the chapter on datatypes, protocols and interfaces in Programming Clojure 3rd edition is excellent

mbjarland18:06:40

it used to be used to repel moths from clothing, mal = moth, ört = herb, malört is the swedish word for wormwood…might be reiterating things, was too tired to read the last hundred messages : )

mobileink18:06:08

wow, now i know why the moths have stopped coming around!

mobileink18:06:23

absinthe, without the romance?

mobileink18:06:01

so far as i know the only place in the world you can get this divine ambrosia is Chicago.

mobileink18:06:51

idea for a programming competition: first place is a bottle of malort. last place is 2 bottles of malort.

seancorfield19:06:36

I quite like Malört. Hard to find tho’… and it’s been a while since I last drank any…

seancorfield19:06:54

(but then, I quite like bitter drinks in general)

anthonyrrubin19:06:58

Seems to be a fad here (Chicago).

anthonyrrubin19:06:06

I have never had it though.

anthonyrrubin19:06:18

I do like a gin and tonic. I am guessing that it is quite a bit more bitter though.

seancorfield19:06:16

Ever had Angostura Bitters? There’s been a recent trend in cocktails to create drinks based on those (and other, similar, bitter tasting additives).

noisesmith19:06:37

I’m a fan of fernet and compari (there’s a drink with a terrible name that mixes the two - a ferrari)

noisesmith19:06:49

two very bitter italian beverages

mobileink19:06:52

if you can't find it locally, try two parts kerosine and one part vodka.

mobileink19:06:17

re: OO. boring, i know, but otoh the question comes up again and again.

noisesmith19:06:36

there’s a question?

seancorfield19:06:32

There’s two questions (at least): 1) does Clojure have any OO features? (yes) 2) are some OO features good/useful (vs is OO just bad all round)? (yes) 🙂

mobileink19:06:56

i'd like to find a bright line between oo and fp a la clojure. best candidate i know of is to think algebraically - a clj protocol is an algebraic signature, and algebras are always polymorphic, just change the model.

noisesmith19:06:26

haskell can claim to do fp without OO, I don’t think clojure can do so at all

noisesmith19:06:55

it has OO fundamental in its design and its implementation

mobileink19:06:48

howsabout "Clojure and OO languages have some features in common"? but i wouldn't call those oo features, since a non oo language can have them.

noisesmith19:06:22

they can have something similar

noisesmith19:06:33

something equally useful.. .but not that feature

mobileink19:06:13

@noisesmith that's an interesting assertion. can you elaborate? i like thinking of clj as oo-free.

noisesmith19:06:26

you’re making bizarre counterfactual arguments about something that could exist but isn’t actually available

noisesmith19:06:58

clojure protocols are OO, they allow late binding via extension

noisesmith19:06:28

clojure collection functions are all built on protocols (or even more OO, underlying java interfaces)

noisesmith19:06:44

clojure functions are objects with an invoke method

mobileink19:06:12

i guess to me oo means classes and instances.

noisesmith19:06:35

and protocols (like the interfaces they build on) are abstract classes

noisesmith19:06:28

each clojure collection is an object of a class implementing various interfaces and protocols describing immutable data

seancorfield19:06:41

defrecord is pretty solidly an OOP construct — or do you disagree with that?

mobileink19:06:41

clojure includes clojurescript, whose host is not oo. so oo is not essential to clj implementation.

seancorfield19:06:01

Assembler is not OO but you can compile OOP languages to it.

noisesmith19:06:15

cljs has defrecord, cljs has protocols…

mobileink19:06:20

@seancorfield i understand why it's natural to think of defrecord in oo terms. but i don't think it's essential to do so. a record is just a datum that satisfies a protocol. that does not make it an instance of an oo class.

bja19:06:50

@mobileink the dispatch system in clojure allows it to be an instance though

bja19:06:03

in fact, isa? recommends it

mobileink19:06:18

i take isa? in that case to mean "is a value that satisfies the protocol", rather than "is an instance of a (first class) class".

noisesmith19:06:49

@mobileink then what is satisfies?

mobileink19:06:52

you can apply the protocol-defined ops to it?

mobileink19:06:56

rather than "its identity is associated with a class". maybe?

mobileink19:06:59

compare: member of a type v. instance of a class. very different ideas, no?

noisesmith19:06:16

yeah, and we have no such thing as the first

mobileink19:06:14

or the second, right?

noisesmith19:06:28

we have classes and instances, we don’t have types

noisesmith19:06:03

not in the “strong typing” sense, the kind you can verify anything about

jsa-aerial19:06:59

Most of the comments here about OO and Clojure are about implementation details and as such are irrelevant to the language semantics.

noisesmith19:06:19

clojure has no formal language semantics apart from implementation

noisesmith19:06:41

and it’s not just implementation, it’s also the constructs available in writing clojure code

noisesmith19:06:03

we don’t have types, or anything that behaves properly like one

noisesmith19:06:16

we do have classes, instances, and implementation of interfaces by those classes

mobileink19:06:19

put it this way: the conceptual structure of Clojure is oo-free. That fact that one host env is oo does not affect that.

noisesmith19:06:53

many of clojure’s core concepts are OO - it’s not a language that is designed to hide or abstract over its host platform

noisesmith19:06:58

contrast eg. scala

mobileink19:06:52

we'll have to agree to disagree on that, i guess.

jsa-aerial19:06:11

I think 'implementation' there is being used in two ways. What you really mean is semantics are defined by the reference implementation behavior. Not the actual code

jsa-aerial19:06:38

Second, of course it is not 'just' implementation - that's why I used 'Most'

noisesmith19:06:00

if you have evidence that clojure is meant to hide its platform’s implementation I’d be fascinated to see it - eveyrthing I’ve seen both in the words of RH and in the actual design of the language indicates that it intentionally exposes the host platform as something end users of the language should use

jsa-aerial19:06:25

I say nonsense to your 'nonsense'! 😉

roberto19:06:52

I agree, everytime I have to interact directly with Java, I have to start thinking like a Java programmer again.

jsa-aerial19:06:10

I never said anything about it 'meaning to hide' it's platform. That is irrelevant

mobileink19:06:06

from "Rationale": "Clojure is the language, JVM the platform". but the jvm is just one of many possible platforms. Clojure is not "a better way to do java".

noisesmith19:06:14

if the language semantics directly include direct interaction with the host platform as a core construct, I can’t see how you can call the implementation platform an irrelevant detail in the language

noisesmith19:06:46

interop is easy to use, and often necessary, and it’s meant to be so

jsa-aerial19:06:36

So, you implement it on something totally different - maybe some underlying C based platform or CL platform. It would still be intended to work with that, but those wouldn't be OO.

noisesmith19:06:31

or js - but hey, we still have records and protocols that operate in an OO way in cljs

jsa-aerial19:06:42

And, generally, you can go days (I can) without knowingly doing any interop or using any of the OOish aspects

noisesmith19:06:44

despite js not being that sort of OO language at all

jsa-aerial19:06:03

You're just making my case...

mobileink19:06:22

not sure who called " the implementation platform an irrelevant detail in the language". but i might go there. Clojure's interop capabilities are amazingly generic.

roberto19:06:31

in all my clojure projects, I have never been able to just ignore Java interop.

roberto19:06:41

and when doing cljs, as well, I can’t just forget the JS part

roberto19:06:47

and always get bitten by it

roberto19:06:03

clojure/clojurescript isn’t a black box in my experience

mobileink19:06:41

e.g. (.foo bar) works for both clojure and clojuresscript. that looks like an anstraction over platform to me.

jsa-aerial19:06:05

In many projects it would be very difficult to ignore the underlying C platform of Clozure Common Lisp. I don't think that makes it reasonable to say it is basically C with some sugar.

jsa-aerial19:06:55

That is still true

mobileink20:06:25

@roberto: agreed. but it's about as close as can get imho, especially when you're trying to balance performance. clojure has always been very prsctical.

noisesmith20:06:27

@jsa-aerial I didn’t say clojure is java with sugar, that would be silly. But I am saying that clojure is an OO language because it directly uses constructs from the platform not only in its implementation details but the surface that it exposes to a programmer using the langauge.

jsa-aerial20:06:19

But by design it could be implemented on top CCL and then you would not have an OO platform.

noisesmith20:06:33

it even makes its own OO constructs that the platform lacks - eg. multimethods and proxy

jsa-aerial20:06:59

I didn't say it had no OOish stuff!

jsa-aerial20:06:27

I don't even know if it makes sense to call mutimethods OO in any typical sense

mobileink20:06:03

@noisesmith maybe we're all working from different ideas about what "oo"means. i think that's part of the problem - there is no widely accepted formal model of oop.

noisesmith20:06:22

clojure doesn’t do typical OO, it does the good kind of OO - which often doesn’t look like java and c++ and that’s fine, but it’s still OO

jsa-aerial20:06:35

Actually, that is undoubtedly true! @mobileink

jsa-aerial20:06:56

Maybe for you it is

mobileink20:06:07

so we end up bickering about who is using words correctly. 😢

noisesmith20:06:22

multimethod is OG OO - “give this thing a message, it will know how to respond”

seancorfield20:06:53

Is part of the problem here that when people hear “OOP” they think of “Java”?

jsa-aerial20:06:02

how is that object 'oriented'? You don't even need an object for this

seancorfield20:06:11

(or their nearest semantic equivalent based on their experience)

Alex Miller (Clojure team)20:06:49

I think https://clojure.org/reference/datatypes is the best summary of Rich's thoughts on this

mobileink20:06:12

@seancorfield bingo. oo is so undefined that our only real option is to fall back on our experiences. the nice thing about fp is that it has a widely accepted formal model (lambda calc, turing).

Alex Miller (Clojure team)20:06:18

I an not quoting Rich but my suspicion is that he would say Clojure is an FP language that has some features common in OO (and is firmly in opposition to others, like concrete inheritance and encapsulation of data)

Alex Miller (Clojure team)20:06:19

Also it's designed to have good host interop so is flexibly harmonious with the host, leveraging what it can there re OO

roberto20:06:46

To quote the man himself:

OOP to me means only messaging, local retention and protection and 

hiding of state-process, and extreme late-binding of all things. It 

can be done in Smalltalk and in LISP. There are possibly other 

systems in which this is possible, but I'm not aware of them.

mobileink20:06:47

@alexmiller one thing from that passage puzzles me: "The abstractions are specified by host interfaces, and the implementations by host classes." how are the abstractions specified by "host interfaces"?

roberto20:06:10

no objects needed (in the sense that most ppl in Java/Ruby etc know them)

noisesmith20:06:40

@roberto - thanks for that, I could have saved a lot of typing if I’d just looked that up and quoted it first

roberto20:06:56

you’re welcom

roberto20:06:17

but even the OO developers disagree with Alan Kay on that. Had a discussion with some folks last week and they totally dismissed Kay’s definition.

Alex Miller (Clojure team)20:06:28

@mobileink here he literally means Java interfaces

seancorfield20:06:48

(in cljs those are specified as protocols)

Alex Miller (Clojure team)20:06:11

The Clojure compiler and runtime are almost completely ignorant of the actual concrete classes implementing those interfaces

Alex Miller (Clojure team)20:06:23

Other than places where they must be constructed

Alex Miller (Clojure team)20:06:00

Which is how you can swap in new data structures and they all know how to conj, assoc, etc

mobileink20:06:07

hmm, i think of the abstractions as things like map, which are part of the language. what am i missing?

seancorfield20:06:07

That doesn’t make Kay wrong, nor those developers right.

seancorfield20:06:49

map works because of the sequence abstraction.

Alex Miller (Clojure team)20:06:06

@mobileink I don't think map is an abstraction that he's talking about

Alex Miller (Clojure team)20:06:21

Rather stuff like sequences

roberto20:06:27

I wasn’t say Alan Kay is wrong. Was just trying to hint at the incongruencies in the OO community and I get the impression many have not researched Alan Kay’s original intent and just get carried away by the buzz words introduced by vendors in the early 90s.

Alex Miller (Clojure team)20:06:35

In Lisp map would work on lists. In Clojure it works on sequences, which are logical lists (via the sequence abstraction)

mobileink20:06:37

ah. he means the abstractions declared/defined by the host env? which clj in a sense abstracts again?

Alex Miller (Clojure team)20:06:55

Abstractions defined by Clojure

Alex Miller (Clojure team)20:06:14

Whose implementation is primarily Java interfaces on the jvm

Alex Miller (Clojure team)20:06:23

And protocols in ClojureScript

mobileink20:06:18

wait, how can an interface implement?

Alex Miller (Clojure team)20:06:45

"define" might be better

mobileink20:06:06

"declare"? 😉

Alex Miller (Clojure team)20:06:52

Many more words in particular areas

roberto20:06:54

in Java 8 an interface can implement now 🙂

roberto20:06:12

Java 9 will introduce private methods to interfaces 🙂

Alex Miller (Clojure team)20:06:15

That's a stupid feature

jsa-aerial20:06:46

A lot of Java 9 is 'stupid'...

roberto20:06:15

as long as we get value objects, I’m fine 🙂.

lfn310:06:19

roberto: value types aren’t gonna make Java 9. Maybe 10… maybe…

roberto20:06:31

It starts to make sense when you hear Goetze explain how they arrive at those decisions

mobileink20:06:32

@alexmiller man, why didn't say so?? that stuff should rilly be in the official docs.

Alex Miller (Clojure team)20:06:44

No, I totally get how they ended up there

jsa-aerial20:06:26

there is no contradiction is something both making sense and being dumb.

roberto20:06:46

I think their main focus now is on the JVM and how they can add features to it. The language is secondary at this point I think. Which makes sense. The JVM languages will improve thanks to the changes they are introducing.

mobileink20:06:12

@jsa-aerial i do that all the time!

jsa-aerial20:06:23

Yeah, so do I. But I'm not controlling the development of a key piece of technology...

mobileink20:06:39

i also sometimes make no sense at all, intelligently.

noisesmith20:06:23

what’s really dangerous is making sense, but dumbly “for every complex problem there is a solution that is clear, simple, and wrong” - Mencken

mobileink20:06:51

you have no future in USA politics.

naomarik20:06:34

replace “clear” and “simple” with antonyms and you’ve described tech solutions that require blockchain for CRUD app type problems