other-languages

here be heresies and things we have to use for work
2017-11-02T00:02:16.000197Z

@hiredman I agree, but remember that the input of the top of the transducer chain is dependent on the output of the last step of the previous iteration of the chain (the reducing function).

2017-11-02T00:03:14.000091Z

Imagine a transducer chain where the acc switches from string to int to string and back. It's not good enough to say it's Union[string, int] because it's only ever an int if the previous iteration was a string

2017-11-02T00:05:17.000059Z

the cat transducer would be (X -> Y -> Z) -> (X -> [Y] -> Z) for example

2017-11-02T00:09:25.000009Z

again, I think that is somewhat spurious, you start off asking "how can you represent transducers" and have jumped to "how can you represent state changes" (or linear types, or whatever it would be called, I am not a type guy)

2017-11-02T00:10:53.000142Z

Yeah, I think that’s the issue though. And what rich has implied on several occasions. Getting something transducer-like is easy. Getting all the aspects of transducers is hard (if not impossible) in existing type systems.

2017-11-02T00:11:02.000072Z

And so at that point I kind of stop car

2017-11-02T00:11:12.000247Z

*caring

2017-11-02T00:14:06.000069Z

that is a facile argument. types are there to limit the ability to express incorrect things, vast swaths of the behavior of untyped transducers allow for would be considered incorrect under most circumstances.

2017-11-02T00:14:49.000085Z

the question is how much you gain by cutting off access to those weird corners

2017-11-02T00:17:34.000127Z

The problem is though that these types artificially limit correct transducers, for little benefit.

2017-11-02T00:17:51.000161Z

do they?

2017-11-02T00:18:13.000014Z

when was the last time you wrote a transducer that switched types of the accumulator?

2017-11-02T00:20:38.000197Z

A few months back, a statistics gathering reducing function that would vary the type of the accumulator depending on the statistic size

2017-11-02T00:21:22.000165Z

do you think you wouldn't able to model that as some kind of ADT?

2017-11-02T00:21:25.000140Z

But I admit it’s ra

2017-11-02T00:21:34.000160Z

wow, I can’t type

2017-11-02T00:21:37.000103Z

*rare

2017-11-02T00:22:04.000210Z

again, I am not a type guy, but that sounds like a candidate for haskell type classes(or clojure protocols)

2017-11-02T00:22:28.000061Z

so the type is some abstract thing that you interact with via some interface that might have different representations

2017-11-02T00:23:04.000268Z

But for me that’s the problem I all I ever hear on Reddit, blogs, HN, etc. is “I’m not a type guru...but....it should be possible”.

2017-11-02T00:23:40.000016Z

because you hang out in dynamiclly typed places

2017-11-02T00:23:45.000133Z

There are some languages that attempt Clojure-like semantics with typing (to bring this back to the OT), but none actually pull it off

2017-11-02T00:23:54.000141Z

I was saying Haskell Reddit, etc.

2017-11-02T00:24:17.000166Z

I think that has more to do with people not actually understanding the entire semantics of most clojure constructs

2017-11-02T00:25:31.000066Z

all I see are straw men on both sides, and of course the reaction from the otherside is "oh, that strawman isn't actually the thing I use"

seancorfield 2017-11-02T00:43:16.000019Z

A transducer has three arities, so it's more complex than (X -> Y -> Z) -> (X -> [Y] -> Z) (to pick on the example above).

2017-11-02T00:44:48.000024Z

Heh yeah, the whole multi-arity thing in Haskell is problematic

seancorfield 2017-11-02T00:45:17.000324Z

And then there's reduced to consider as well -- since any reducing function can produce that.

2017-11-02T00:48:17.000103Z

I saw a Haskell transducer implementation recently that got close to the right semantics, but it did so via tailcalls, continuations, and state monads, and about half way through my Haskell fu failed me.

seancorfield 2017-11-02T00:48:28.000121Z

(given that Haskell functions always take exactly one argument, how do you even model a niladic function?)

2017-11-02T00:49:03.000171Z

Also I think they handled reduced via some sort of interpreter dispatch. Return :reduced if done, return :continue to continue to the next step.

2017-11-02T00:49:41.000137Z

that is generally how the iteratee stuff works

2017-11-02T00:49:42.000010Z

@seancorfield I saw an example of that in F# recently, but it wasn’t standard ML I think.

2017-11-02T00:51:37.000066Z

the other thing I think is, who cares if you can represent transducers? do they intrinsically have value? no, they have value as a solution to some problem, does the typed world have their own set of solutions to those problems? generally yes. so does it matter if you can represent something from the untyped world?

2017-11-02T00:54:05.000213Z

No, of course. But my interest in this area is somewhat selfish and political. I get tired of having to defend dynamic languages as somehow being a sub-par language. Being viewed as a coder of “unsafe” programs. And that’s something I have to actively combat when working with some clients.

2017-11-02T00:54:54.000033Z

So I appreciate finding aspects of dynamic languages that are simpler, and more natural than corresponding aspects of static languages

seancorfield 2017-11-02T01:00:18.000046Z

Yeah, having folks bandy around "unethical" about "non-statically-typed languages" tends to cause division...

seancorfield 2017-11-02T04:40:11.000100Z

Because I'm a masochist... learning Kotlin and wrote my first unit test with KotlinTest... running it via Clojure (of course!):

boot -d seancorfield/boot-kotlinc -d io.kotlintest/kotlintest kotlinc -k src/kt -k test/kt call -p -e "(import '(learning SumTest) '(org.junit.runner JUnitCore))" -e '(bean (JUnitCore/runClasses (into-array Class [SumTest])))'

seancorfield 2017-11-02T04:41:30.000090Z

No need to install anything. Just write my src/kt/hello.kt and test/kt/hello.kt files and compile & run the tests ... so easy! 🙂

roberto 2017-11-02T14:11:28.000574Z

I agree that the comment made about ethics & un-typed languages is problematic (to put it mildly), however, I dabble in both worlds, and it is infuriating when ppl on both camps start yelling at each other. These are just tools to get the job done. We don’t get into religious battle about what brand of fork we use when eating, why do we have to fight over type vs un-typed. They are tools that allow us to find solutions to problems, sometimes in different ways.

3
fellshard 2017-11-02T17:19:29.000004Z

I was in a brief project using Ruby with a teammate who resisted dynamic languages pretty strongly, mostly due to prior experience with JS. Was able to demonstrate the pros and cons of following Ruby's approach, showing when dynamic typing provides alternatives instead of merely removing or adding things. Where you have to work harder to assure some properties, other properties come easily. It all came down to the ability to reason about what was going on, for us, and the 'comfortable subset' of Ruby ended up feeling a lot more stable than the 'comfortable subset' of JS.

1👍
2017-11-02T20:02:32.000454Z

I'm all for the pros/cons approach, and I think that's the best way to go about it. The problem is when any approach reaches the level of dogma. That was the case not too many years ago with OOP. You couldn't find a job, or start a project in a language that wasn't OOP. I really don't want to see that with type systems.

val_waeselynck 2017-11-03T08:41:12.000260Z

@tbaldridge you should write about that, I think that would be a much more interesting blog post than all the 'let's implement feature X with(out) type systems' 🙂

roberto 2017-11-02T20:28:06.000350Z

Yes, I agree, I’d hate to see another one of those OOP-style dogmas that took over the industry. I feel like it kept the industry back because it didn’t allow us to explore and try new ideas. That is why I also dabble in both typed and un-typed languages. Because both have lots of concepts and ideas to teach me. And there are brilliant minds on both sides. When we lock ourselves up in one camp and start having these flame wars, it only keeps us (and future generations) back.

1👍
roberto 2017-11-02T20:38:32.000236Z

For example, although my first languages were C and Java, I built my first real project using PHP when I was a student. And used it for a quite a while. But I also fell in the wrong crowd and bent to peer pressure and started to have contempt for PHP. Mostly because I bought into the OOP camp and since PHP didn’t support OOP, well, it was deemed a sub-par programming language. But when I look back, it was very simple, and I was able to pass in functions, and return functions. By removing all the complexity of OOP, it did offer some valuable lessons, that we just threw away for years because OOP was king. And that sort of attitude still exists today within the wider programming community. We look down our noses at different languages because it doesn’t fit within our mental model of what the best language should be.

fellshard 2017-11-02T20:55:24.000098Z

There's a difference between discarding imperfect in pursuit of perfect and identifying languages with deep flaws that work against your ability to model any system will, such as PHP and its incessant inconsistency.

1👍
seancorfield 2017-11-02T20:56:09.000651Z

Languages have always fascinated me. I learned programming as a teenager using calculators (Sinclair, then TI-58) and my school ran an optional correspondence course in Algol 60 (turnaround time on your homework was one week!). At university I learned about a dozen languages and my final year project was to write an APL interpreter (in Pascal). Then I did PhD work on FP languages. Then got a job at a small UK compiler company. So I've developed strong opinions on language design -- and I love some languages and detest others, mostly due to syntax rather than semantics 🙂

fellshard 2017-11-02T21:01:42.000507Z

I have a running theory that people in the industry: 1. See learning new languages as being the most difficult task one could take on, especially if they only know one language deeply to begin with 2. See old 'dead' languages such as Lisp, Prolog, and Smalltalk as wastes of time because they are not widely used instead of examining why they were made and why they were shunted aside For those reasons, I push those around me to consider and try new languages, any new languages, especially in paradigms unfamiliar to them, because oftentimes that lifts them up by an order of magnitude in understanding software as a whole, and in seeing the tradeoffs available to them.

seancorfield 2017-11-02T21:04:01.000403Z

I'm a TA for the online version of Univ. of Washington's "Programming Languages" course that uses Standard ML, Racket, and Ruby to illustrate various aspects of language design and I'm no longer surprised (5+ years into doing this) that students always ask "Why should I learn SML/Racket when they aren't used in industry?"

1😁
seancorfield 2017-11-02T21:04:10.000083Z

Not surprised, but still depressed 🙂

fellshard 2017-11-02T21:04:59.000606Z

I went through that very class, and it's what sold me on Lisp and FP.

seancorfield 2017-11-02T21:05:47.000569Z

I think it's a great course! I took it initially as a student back in 2012 I think and I've been a TA/mentor in every single run of it since.

fellshard 2017-11-02T21:08:01.000255Z

It is odd that the schooling for CSE has placed such a sharp divide between scholastic software and applied software, though, especially when not in the context of a trade school.

seancorfield 2017-11-02T21:20:02.000095Z

@fellshard What would you pick in place of SML and Racket -- given the teaching objectives of that course?

dpsutton 2017-11-02T21:21:32.000267Z

we had a nice PL class with a scheme metacircular interpreter, smalltalk and snobol4 of all things

fellshard 2017-11-02T21:22:16.000176Z

I don't know that I would! Maybe some things more out of the ordinary instead of Ruby - Forth, Prolog, or one of the array processing langs that doesn't require special charsets

fellshard 2017-11-02T21:22:51.000269Z

Smalltalk is hard to do these days, though I'm finding Pharo to be a reasonable starting point

dpsutton 2017-11-02T21:23:31.000230Z

we had to abandon our occam project because there werern't any 64 bit compilers

1😞
seancorfield 2017-11-02T21:32:01.000159Z

Occam... That takes me back! I sat in on CSP course at uni (run by a different department, so it didn't count for my degree). And one of my jobs in the early 90's was to write a transpiler targeting Parallel-C for the Transputer (source was a somewhat arbitrary "actuarial formula language").

roberto 2017-11-02T21:56:19.000039Z

I took that coursera course too, and it is how I fell in love with SML. I had so much fun with it.