Better HN
topnewbestaskshowjobs
Log inSign up

grumpyprole

4,485 karma · joined Jun 30, 2015 (11y ago) · 2,043 submissions

Submissions

comment 4y ago · link · parent

SML/OCaml has built-in cons lists and is great for symbolic manipulation. Everything is an expression and there's too many parens.

comment 4y ago · link · parent

I did not mean to imply it was a Lisp. It was designed to solve the same problems as lisp, i.e. symbolic manipulation; and was used to rewrite code originally written in Lisp.

comment 4y ago · link · parent

Hardly a ringing endorsement! Python is certainly succinct and expressive like Lisp (when his alternative is Java). ML was designed to be a better Lisp.

comment 4y ago · link · parent

> I also have no real desire to dive into strongly typed functional languages -

That's a big shame. But don't knock it until you've tried it.

> And all of those modern functional languages are as fringe (or even more fringe) than Lisp is.

I'm not convinced Lisp is more popular anymore. I've spent the last 10 years being a full time Haskell and OCaml programmer. The killer application is compilers and associated tooling. Almost no one is choosing Lisp for this today. And why would they?

> but let's be honest: programming languages that appeal to mainstream developers

Where do you think the newer mainstream languages are getting e.g. algebraic datatypes and pattern matching from?

comment 4y ago · link · parent

ML was designed in the 70s by Robin Milner to replace all the LISP code he had. Just like LISP it was designed for symbolic manipulation. They are far more similar than you are giving them credit for; and usually recognised as part of the same family tree. The System F calculus also has a "totally different approach to types" but it evolved from the Lambda calculus. ML and Haskell are based on System F and its successors.

comment 4y ago · link · parent

Norvig is a teacher and author who wants to reach the widest audience possible. So in his case, it was either Java or Python.

comment 4y ago · link · parent

Lisp evolved into ML and Haskell and these have influenced professional programming enormously over the last few decades. Or are you advocating we ditch all progress and go back to Lisp? Have you tried an ML such as OCaml? It has built-in cons lists, convenient symbol manipulation and macros.

comment 4y ago · link · parent

> I would further argue that business data be dynamically typed, because business data is often messy and changeabl

Huh? Static types make change and refactoring much easier.

comment 4y ago · link · parent

> "At some point functional programming became equivalent in people's minds to complex type systems (e.g., monads), and that caused the value of Lisp to be lost to history. It's a shame."

This is nonsense. Types help us name, categorise, discuss and share abstractions. These abstractions are useful in any language, typed or otherwise. Lisp lives on in its descendents ML and Haskell. If someone doesn't want to learn anything new, then they are themselves "lost to history".

comment 4y ago · link · parent

Given ETH only switched to proof-of-stake this year, I think perhaps it's a bit early to call it out as a long-standing energy efficiency success.

comment 4y ago · link · parent

> BTC (on chain) is still working as intended, after all these years.

It's certainly working on destroying the planet with its obscene energy requirements.

comment 4y ago · link · parent

> [Swift] it's such a great example of how you can have a language that feels like a scripting language but with much more advanced type safety.

There are great examples far older than Swift, for example ML that dates back to the 1970s, or OCaml that's as old as Java.

comment 4y ago · link · parent

I am saying that an object has a type, rather than is a type or some augmentation of it.

An object is a term-level construction and therefore is not really comparable to a type. Types can be given to both state and behaviour. For example, a function type describes pure behaviour.

Note that statically-typed OOP languages have a name for the nominal types of objects: "classes". One could say that a class is a type representing both state and behaviour.

comment 4y ago · link · parent

To compare them this way is likely to cause confusion.

A type (of a term) represents the set of all possible values for a particular term. An "object" in OOP, does not have any formal definition, but is typically a first-class module with mutable state. As such, they can be represented by a term and therefore can have a type.

comment 4y ago · link · parent

> types are basic building blocks

Yes but they should also be compositional, one should build larger types from smaller types. This is how we scale to solving difficult problems.

> but currencies are a moving target and needs constant update to handle the quirks of the real world.

This is a separate issue orthogonal to types. The problem of modelling the real world and what models might be more generally useful. No model is perfect, all have trade-offs.

> In my book the string is a great way to store a country of origin

As an implementation using a string sounds pragmatic, but that should not be its type! You should still create a currency type and parse into it. Then you won't accidentally pass an arbitrary string to a parameter that is supposed to be a currency.

comment 4y ago · link · parent

FP has one distinct advantage over many other paradigms, it has very sound and well understood theoretical foundations, being essentially based on the formal mathematical logics (e.g. System F and its derivatives). This has huge implications for correctness and reasoning.

comment 4y ago · link · parent

> If Python or JS sit idle waiting for user input, are the efficiencies really so different?

Nit pick: Python is typically at least an order of magnitude slower than JS, it's a whole different class of slow.

> Developer time also has energy cost in AC, transport, etc for a human.

Yes and fixing bugs in production is especially expensive. Presumably that's why Python is now trying to retrofit static types. There are statically typed languages that are just as terse as Python.

comment 4y ago · link · parent

Or perhaps because knowing/reasoning about at least some properties before running a program is a good thing? Optimisation is only one consequence of static types. Perhaps the reason is that static type systems are getting better and less intrusive.

comment 4y ago · link · parent

> Not all programmers have the same goals and problems.

That's why we have different programming languages. The danger of making a language a jack-of-all-trades is that it will be master of none. Restrictions are more often than not a good thing, they give the power to reason, for both humans and machines (giving, for example, memory safety).

comment 4y ago · link · parent

OCaml is another example of fast compilation and static typing.

comment 4y ago · link · parent

Clojure encourages pure functions and immutable data, so definitely a "functional first" language. But it's not a "purely functional" language.

comment 4y ago · link · parent

Maybe :) But I would suggest that the abstract algebra and category theory would probably be a more worthwhile investment longer term than learning about Spring Beans.

comment 4y ago · link · parent

> Pure Functions are an implementation strategy of FP, not the core differentiator.

"Functional Programming" is not a well-defined term. But I would argue that if you are not using pure functions then you have more of a hybrid imperative/functional language, which is fine, especially if you are careful with how you structure your effects. Modern FP languages use monads (Haskell) and/or algebraic effects (Eff) to enable pure functions to describe effects. The pure function is what enables mathematical reasoning and safe function composition.

comment 4y ago · link · parent

> With Optional you have two problems, you can get a null AND you can get an empty.

That's not really the fault of the Optional. That's Java adding null as value to every type. Java also allows lists of nulls, mappings to null etc. An optional is just a container that stores one item at most. I do agree that it makes optionals less useful in Java. In Haskell and OCaml they are used essentially instead of null.

comment 4y ago · link · parent

Log4J doesn't just log strings, it has an evaluator that can execute the strings and invoke arbitrary code. There is no enterprise that needs this feature. Describe the actual problem, and let's work out how it can be solved without stuffing a new programming language into a string.

comment 4y ago · link · parent

Not as stupid as claiming it's just another security flaw. Some of us also aspire to better.

comment 4y ago · link · parent

Yes I have worked for many banks and even written Log4J loggers that log to chat channels. But I can still admit that Log4J is over-engineered and that a security flaw was inevitable. Log4J doesn't just log strings, it has an evaluator that can execute the strings and invoke arbitrary code. Are you telling me that your bank needed that feature?

comment 4y ago · link · parent

"The Log4j Vulnerability: Millions of Attempts Made Per Hour to Exploit Software Flaw - Hundreds of millions of devices are at risk, U.S. officials say"

https://www.wsj.com/articles/what-is-the-log4j-vulnerability...

comment 4y ago · link · parent

> If anything it is too flexible and gives developers too many features

Over-engineering: "the act of designing a product or providing a solution to a problem in an elaborate or complicated manner"

comment 4y ago · link · parent

> what exactly is over-engineered and why we as users would even care if it's overengineers somewhere under the hood?

Log4J has been a major embarrassment for the Java community. I suggest you Google it, if you don't know why.

> It's hard to criticize Spring Core

Spring Core is at best a dynamic (reflection based) band-aid to work around Java's lack of expressiveness. It comes at a significant complexity cost and loss of static guarantees. You cannot both love Spring and Java. So which is it? :)

1
151617
69