other-languages

here be heresies and things we have to use for work
martintrojer 2016-05-17T06:20:08.000746Z

well, always hard to compare ofc.

martintrojer 2016-05-17T06:20:43.000747Z

The first post in my blog series sums up how I feel.

martintrojer 2016-05-17T06:26:04.000748Z

I tend to work in more and more complex clojure apps, 30k+

martintrojer 2016-05-17T06:26:28.000749Z

not easily "breaking-uppableโ€ into โ€˜microservices'

martintrojer 2016-05-17T06:26:58.000750Z

as the code grows, team grows, time elapses, Clojure stops being your friend.

sveri 2016-05-17T07:36:33.000751Z

Thats exactly the reason I always wanted to code clojure in a professional setting in a larger team, to figure out how it behaves there and where the pitfalls are.

martintrojer 2016-05-17T09:00:37.000752Z

the mitigations are the same as for any dynlang. lots and lots of tests

martintrojer 2016-05-17T09:01:16.000753Z

50% is an absolute minimum, higher better

borkdude 2016-05-17T09:01:59.000754Z

one problem with static typing in a team I'm currently seeing is that they give a sense of 'set in stone' while in practice most code is temporary and the types are not given as much thought as the reader expected

๐Ÿ‘ 1
borkdude 2016-05-17T09:02:44.000756Z

maybe this is a problem with all code. as a I reader I'm set on the wrong foot because I'm trapped in the initial design

martintrojer 2016-05-17T09:02:59.000757Z

@borkdude: what language is that?

borkdude 2016-05-17T09:03:06.000758Z

@martintrojer: does it matter?

martintrojer 2016-05-17T09:03:15.000759Z

in my experience, absolutely

borkdude 2016-05-17T09:03:27.000760Z

@martintrojer: This is Scala, but I have had the same experience in Java

borkdude 2016-05-17T09:03:40.000761Z

Classes give me the same feeling, that I should not change them

martintrojer 2016-05-17T09:03:56.000762Z

Iโ€™m not even considering C-style typed languages

martintrojer 2016-05-17T09:04:05.000763Z

Java, C# falls squarely into that bucket

martintrojer 2016-05-17T09:04:18.000764Z

Scala also, if you use it like Java++

martintrojer 2016-05-17T09:04:43.000765Z

Hindley Milner type inference is a minimal requirement

martintrojer 2016-05-17T09:05:22.000766Z

Professional experience is F# and I (and the team) found more liberating than Boo (the dynlang we had some code in)

martintrojer 2016-05-17T09:05:33.000767Z

Iโ€™ve never refactored with such confidence and speed.

borkdude 2016-05-17T09:07:17.000768Z

Clojure is the only language where I really felt productive and fast, even in a team. I don't have this feeling with Scala now, yet.

borkdude 2016-05-17T09:08:07.000769Z

However, all larger projects become slower, despite the language of choice.

๐Ÿ‘ 1
martintrojer 2016-05-17T09:09:01.000770Z

IMHO, dynlangs scales terribly

borkdude 2016-05-17T09:10:27.000771Z

@martintrojer: I wonder how they deal with this in Boeing and Walmart, where they do have big teams working on 30k lines of Clojure

martintrojer 2016-05-17T09:12:47.000772Z

Metric ton of tests I'd imagine

borkdude 2016-05-17T09:13:00.000773Z

I see the benefit of being able to refactor more easily when you change some case class, record, or what have you. But I'm not sure if the sacrifice of flexibility and REPL are worth the static typing. I'm just going to look at results in practice, not theory.

sveri 2016-05-17T09:29:44.000774Z

All in all I think one can conclude that neither dynlang nor HM-typing provides benefits that are so obvious that everybody agrees on it, like the benefits that garbage collection for instance, gave us.

๐Ÿ‘ 1
borkdude 2016-05-17T09:30:51.000775Z

@sveri: I think that is correct

borkdude 2016-05-17T09:40:28.000776Z

@sveri: I think what you can also say is that no language can be evaluated without humans. It's the human-language combination that makes it work. It's probably also why it's so hard to study in practice.

sveri 2016-05-17T09:44:47.000777Z

@borkdude: Agreed, OTOH if I would have to implement a language that could be used by a computer, it would probably be a typed one, but this is just more of a feeling that I have here.

borkdude 2016-05-17T09:46:04.000778Z

@sveri: it would probably easier for AI to discover patterns in typed languages, for example, just try all functions from String -> Int and Int -> Boolean and see if you can come up with a function from String -> Boolean that does the right thing

borkdude 2016-05-17T09:46:43.000779Z

@sveri: On the other hand, good enough AI could infer the types in a dynamically typed language. On the bare metal, nothing is typed.

borkdude 2016-05-17T09:46:50.000780Z

Types are mostly a compile time illusion.

๐Ÿ‘ 1
sveri 2016-05-17T09:52:29.000781Z

@borkdude: Then the question boils down to, can the "AI" infer behavior / rules / types from machine code?

borkdude 2016-05-17T09:54:50.000784Z

I don't know

sveri 2016-05-17T09:55:29.000786Z

probably not, so it needs a language it can use

sveri 2016-05-17T09:55:52.000787Z

and the more strict the language is, the easier it is to implement the "AI", I think

borkdude 2016-05-17T09:57:38.000788Z

we are on a side path, AI is not the point

borkdude 2016-05-17T09:58:04.000789Z

I think good AI could infer types from dyn. code. But it's not the point.

borkdude 2016-05-17T09:59:07.000790Z

http://www.cs.umd.edu/~jfoster/papers/popl11.pdf

borkdude 2016-05-17T10:17:18.000791Z

Maybe the machines force us humans to use more types, against our own will (ok, entering sci-fi mode)

borkdude 2016-05-17T10:18:22.000793Z

I saw a documentary once where one philosopher thought that the internet is it's own intelligence that is using us humans, not the other way around

sveri 2016-05-17T10:58:38.000794Z

This reminds me of capitalism itself where the goal is to expand and corporations / humans fullfill the capitalisms will...

sveri 2016-05-17T11:28:10.000795Z

Gerhard Gundermann once wrote a song about capitalism where he talks about consumption and finally concludes that it would be better if it was not human beings drinking beer at the bar, but instead why not have machines drinking the beer and consume them themselves. Also he asked about the proportions of car driving, if you think in terms of weight is it us, that drive the cars or is it the cars, driving us...

sveri 2016-05-17T11:29:38.000796Z

And to draw the circle...if google can predict what you will do in the next days and then shows ads to you, helping you achieve your goal (in whatever way). Was it still you that decided your next move? Or was it googles prediction?

borkdude 2016-05-17T11:30:15.000797Z

I saw a documentary about the Amish recently. They seem to be quite happy without all this technology.

borkdude 2016-05-17T11:30:46.000798Z

The documentary was also about Google and/or Facebook rolling out global internet

borkdude 2016-05-17T11:30:49.000799Z

in for example India

arrdem 2016-05-17T15:10:38.000800Z

"types are mostly a compile time illusion" what?

borkdude 2016-05-17T15:13:24.000801Z

@arrdem: at least on the JVM right?

arrdem 2016-05-17T15:14:50.000802Z

No absolutely not. Unless you're referring to erasure...

borkdude 2016-05-17T15:15:04.000803Z

I was thinking about type erasure, correct

arrdem 2016-05-17T15:16:29.000804Z

That's hardly true tho. Erasure is an implementation detail of parameterized types. All the type information is preserved at compile and runtime, but the compiler emits checkcasts to make that happen.

arrdem 2016-05-17T15:17:03.000805Z

Nowhere near the same as Clojure or python "well it's a map and I have no idea because everything else is a map too"

borkdude 2016-05-17T15:17:25.000806Z

Thanks for correcting me. I should think more about it ๐Ÿ™‚

arrdem 2016-05-17T15:17:37.000807Z

Not that Java's type system isn't crippled and bad, but yeah.

arrdem 2016-05-17T15:21:36.000808Z

IMO @martintrojer is absolutely correct here. Types are absolutely essential for 1) optimizing programs and 2) reasoning statically about unknown code. HM and dependently typed languages are the future.

arrdem 2016-05-17T15:22:58.000809Z

My experience with Clojure has been that picking up someone else's code is on average miserable because invariably the "schema" (type) is either undocumented or incompletely documented.

borkdude 2016-05-17T15:24:00.000810Z

I agree that typed is better for compiler optimisations and for static reasoning.

arrdem 2016-05-17T15:24:13.000811Z

And in those rare cases where someone has taken the time to use assertions or schema or otherwise check their datastructures in an understandable way, you've just approximated HM badly with no guarantees.

arrdem 2016-05-17T15:24:59.000812Z

Half my setup time on a new project is figuring out what the existing libraries expect to consume and what record structures I want to use myself.

arrdem 2016-05-17T15:25:08.000813Z

Read: types

borkdude 2016-05-17T15:26:04.000814Z

The problem of Scala I'm currently dealing with has probably got to do with: hey, the language + JVM offers all these cool features, let's use them all. If there was something simple like Clojure with all the benefits of static typing, with a community like Clojure, I'd be very interested.

arrdem 2016-05-17T15:26:56.000815Z

Yeah. That's super shitty and what turned me off about scala the two times I've had to use it so far.

borkdude 2016-05-17T15:27:01.000816Z

It's not like I understand other people's Scala code better than Clojure. It's the other way around here.

arrdem 2016-05-17T15:31:50.000817Z

I mean, just to hammer the point home... Go read Wadler's "propositions as types", and realize that for type broadly considered you can (try to) statically prove any condition you'd dynamically assert about your data. You just sometimes can't prove and have to emit dynamic checks ala checkcast above, but even then the possible failure modes are explicit and manageable.

arrdem 2016-05-17T15:32:35.000818Z

I personally would love to see someone put together a precondition predicate based type system for Clojure. That would be super interesting.

arrdem 2016-05-17T15:35:11.000819Z

Alright I'm done :P

borkdude 2016-05-17T15:35:37.000820Z

We haven proven all these nice properties about our code. But does it work? ๐Ÿ˜‰

borkdude 2016-05-17T15:36:35.000822Z

The daily code I'm dealing with is not so interesting in terms of "properties", like sorting algorithms, etc.

arrdem 2016-05-17T15:37:39.000824Z

Property here for me means amazing mundane stuff like "is it a positive integer"

arrdem 2016-05-17T15:37:51.000825Z

Does this validation regex match

arrdem 2016-05-17T15:38:00.000826Z

Etc ad nauseum

arrdem 2016-05-17T15:38:23.000827Z

Not trying to talk about proofs of program correctness

borkdude 2016-05-17T15:38:41.000828Z

@arrdem: how can you test it before the run time

borkdude 2016-05-17T15:39:01.000829Z

without moving your entire runtime in the compile time ๐Ÿ˜‰

arrdem 2016-05-17T15:40:17.000830Z

You can't. You get better warnings up front that what you've codified doesn't make any sense and then you have a repl that's no worse than ours. (thinking of Haskell explicitly here)

arrdem 2016-05-17T15:40:59.000831Z

Testing still matters, you just have sanity properties for free rather than having to guard them everywhere by hand.

arrdem 2016-05-17T15:41:53.000832Z

I mean... Clojure's error messages and dynlang error debugging are what you get for gigo applied to data.

borkdude 2016-05-17T15:42:49.000833Z

true, but the feedback you get is extremely fast in a runtime REPL

arrdem 2016-05-17T15:43:04.000834Z

Far better IMO to try as hard as possible to be strict about data up front and minimize the set of failure modes a programmer can experience or has to code.

borkdude 2016-05-17T15:44:07.000835Z

Being strict about data up front vs. exploring and finding out what this data should be shaped like

arrdem 2016-05-17T15:44:46.000836Z

The promise of HM is that you still can do that thanks to inference tho.

arrdem 2016-05-17T15:45:21.000837Z

If you want to try another representation you can, it's just infers to a different type which is absolutely correct.

borkdude 2016-05-17T15:46:14.000838Z

Haskell probably gives a much better experience than other typed FP languages out there now, maybe F# being an exception

arrdem 2016-05-17T15:46:58.000839Z

Besides my experience has been that most "types" or "shapes" people ultimately wind up with map directly onto a simple record type so...

borkdude 2016-05-17T15:46:58.000840Z

Something in between Clojure and Haskell that doesn't suck?

arrdem 2016-05-17T15:47:08.000841Z

Working on that :P

๐Ÿฆœ 1
arrdem 2016-05-17T15:48:17.000842Z

Love ambrose but core typed sucks. Schema doesn't try for real interprocedural types. Jaunt will eventually support at a minimum Java's types in full.

borkdude 2016-05-17T15:48:35.000843Z

interprocedural types - what's that?

borkdude 2016-05-17T15:48:54.000844Z

yes, core.typed has never reached production quality

borkdude 2016-05-17T15:49:12.000845Z

he's still working on it I think

arrdem 2016-05-17T15:49:20.000846Z

My bullshit term. Just means inference and lifting nested contracts to the interface level.

borkdude 2016-05-17T15:49:26.000847Z

(my god, Slack is slow even on my Macbook Pro)

2016-05-17T15:49:56.000848Z

borkdude: run moar webkit!

arrdem 2016-05-17T15:50:03.000849Z

Ehehe

2016-05-17T15:50:15.000850Z

borkdude: i use weechat and the irc gateways

arrdem 2016-05-17T15:50:21.000851Z

Alright. I should get out of bed and do things rather than rant all day.

2016-05-17T15:50:29.000852Z

i have 3 'teams' and...45 channels

2016-05-17T15:50:37.000853Z

memory impact is effectively zilch