HNHacker News
TopNewBestAskShowJobs

grumpyprole

4,485 karma · joined June 30, 2015

submissionscomments
grumpyprole··on OCaml: a Rust developer's first impressions
Glad to hear there is more to come! I do think OCaml 5 not only keeps the language relevant but also makes it even more interesting.
grumpyprole··on OCaml: a Rust developer's first impressions
The Seq module has more functions than the List module. There are also more of_seq functions than of_list throughout. 5 years ago the compiler standard library was not a serious proposition, it is becoming more so now.
grumpyprole··on OCaml: a Rust developer's first impressions
> You're also correct that you don't have to use lists, but again most OCaml code does.

If the list is not being used in a critical section, what's the problem? The implication here is that OCaml is slow or inefficient. OCaml is often orders of magnitude faster than other high-level languages (e.g. Python). Arrays in OCaml can result in some very fast code.

grumpyprole··on OCaml: a Rust developer's first impressions
> Where are the types?

OCaml supports type annotations practically anywhere, if you want to add them. Alternatively, you can use an editor that supports querying or showing types for bindings. VSCode and Emacs support this.

> Remember recursion? How about linked lists?

A lot of beginner material uses List to introduce algebraic data types, inductive and equational reasoning - but you don't have to use them. In fact, the standard library encourages Seq instead over List.

It's a shame the author did not get past the basics, as there are many interesting comparisons to be made. For example, OCaml 5 effect handlers are a very interesting alternative to Rust's Async.

grumpyprole··on 15 Years of Android Memories
Pixel phones are the bleeding edge though. You are basically beta testing for the other Android vendors.
grumpyprole··on How LSP could have been better
The biggest problem with LSP is that it's a lowest common denominator solution. If I try to edit OCaml using an LSP solution, I don't get features like "query type of symbol", presumably because JavaScript doesn't need it.
grumpyprole··on An alternative front end for Haskell?
Yes this appears to be a silly suggestion, tuples are everywhere, especially as arguments for functions where it does not make sense to name the fields. They are also a structural type and records in Haskell are, unfortunately, nominal types. If Haskell records were structural (one would use newtype to make a nominal record), then tuples could be syntactic sugar for a structural record with field names 1, 2 etc. There is value in unifying them with records, but we still need them.
grumpyprole··on Pixel 8 Pro
> From where I'm sitting software is millions of times better today than it was in the 90s when I first started hearing people saying this.

Define better. I enjoyed computers more in the 80s. There was less bureaucracy. Cubase on the Atari ST never crashed. The modern C++ one does crash, often.

grumpyprole··on What every software developer must know about Unicode in 2023
I would suggest that len works as the article suggests; and "Hello".codepoints gives the behaviour you want.
grumpyprole··on What every software developer must know about Unicode in 2023
> And for this reason, String iteration should be based on codepoints

Why not offer both and be clear about it? Rather than just "length", why not call them code points? The Python docs for "len" which can be called on a unicode string say "Return the length (the number of items) of an object.". It doesn't look like a clear and easy to use API to me.

grumpyprole··on Fiber in C++: Understanding the Basics
> Fibres, goroutines, promises, futures, job queues, etc, are poor substitutes for Actors.

They are not necessarily substitutes, they are lower level primitives that allow more complex models, like Actors, to be implemented.

All execution models have trade offs; and sometimes we might prefer an execution model without deadlock, livelock and starvation. So for a general purpose language, a complex model like Actors is ideally a library and not enforced as the only way of achieving concurrency.

grumpyprole··on Java 21: The Nice, the Meh, and the Momentous
One example for you: anytime you needed to use the "Visitor pattern" to do a transformation from one representation to another - you don't need it now. Sealed classes and pattern matching will be more succinct and easier to reason about.
grumpyprole··on U.K. rejoins Horizon Europe research funding scheme
Don't forget the bus that promised 350 million extra per week for the NHS !
grumpyprole··on Windows Subsystem for Linux 2.0 release
This bug makes WSL a pain to use on laptops. I hope it's fixed!
grumpyprole··on AMD’s Phoenix SoC
I have a work provided X1 Carbon with an Intel that often overheats and throttles. Would an AMD solution be better?
grumpyprole··on Java 21 makes me like Java again
> C++ doesn't have any "memory problems"

Well, every time I see someone claim this, I roll my eyes.

grumpyprole··on Maybe Rust isn’t a good tool for massively concurrent, userspace software
> and not the "I think Haskell and Ocaml is great readability" academic crowd.

Actually, Rust could still learn a lot from these languages. In Haskell, one declares the call site as async, rather than the function. OCaml 5 effect handlers would be an especially good fit for Rust and solve the "colouration" problem.

grumpyprole··on Maybe Rust isn’t a good tool for massively concurrent, userspace software
> Async/await is here to stay and is the right abstraction, git good, and it's not even difficult to use anyway.

It's probably the right abstraction for Haskell, or any other language that works well with functional programming, lambdas and monads. Loom is a better fit for Java. Rust also would have probably been better off with something else. Effect handlers might have been a good choice.

grumpyprole··on What's new in Emacs 29.1
Similarly you cannot use LSP to query the type of a symbol, something I do all the time in OCaml and other typed languages.
grumpyprole··on Giving up the iPad-only travel dream
I'm spoilt by my Kinesis keyboard, I just can't use any laptop keyboard for a significant amount of work.
grumpyprole··on HelloSystem: A graphical OS built on FreeBSD
My theory was that RedHat was concerned about software patents and/or law suits, so felt they had to significantly change Gnome 2, even if it would make people less productive.
grumpyprole··on Leaving Haskell behind
Maybe. I've seen few Java apps that don't use Spring or something similar. The parent described a simple domain, arguing it is the common case, but nonfunctional requirements like testing typically make the problem more complex. So I dispute that Java is good enough for the common case and that nothing from Haskell would be beneficial. Incidentally, Java's leadership agrees.
grumpyprole··on Leaving Haskell behind
> Gradle is declarative

Gradles own docs say "Well-designed build scripts consist mostly of declarative configuration rather than imperative logic".

When it's up to the programmer to make a script declarative, it's not a declarative language.

grumpyprole··on Leaving Haskell behind
If Java is so great at solving these "simple" problems, then why do hugely complex frameworks like Spring exist? The language features of Haskell that you mention can describe your "simple operations" symbolically, you then just need to write a few different interpreters, one for real services, one for testing etc. No dependency injection, aspect-oriented programming or AbstractSingletonProxyFactoryBeans needed. You might feel that the complexity has just moved, but I'd much rather invest my time in solutions that are not ad-hoc.
grumpyprole··on Leaving Haskell behind
Yep, SBT and Gradle make Maven look good.
grumpyprole··on Leaving Haskell behind
Don't forget Scala's SBT, an awful design with lots of additional bad taste added on top.
grumpyprole··on Leaving Haskell behind
Having developed Haskell professionally for many years, I've spent the last two years programming OCaml professionally. I've been really enjoying the OCaml tooling: dune, Merlin and ocamlformat work extremely well for me. Dune especially is packed full of features, for example a file-watch mode for tests. Merlin doesn't choke on large codebases like some of the Haskell tooling did and ocamlformat works better than any code formatter I have ever used. The tooling is so good, I can forgive the rather minimal standard library. OCaml is also very good regarding backwards compatibility, new releases don't break our builds.
grumpyprole··on Building a digital music collection in 2023
Don't forget also that re-encoding often happens with wireless streaming technologies such as Bluetooth. The effects of this are much less well studied. Bluetooth has more chance of sounding fine with a lossless source like FLAC.
grumpyprole··on C and C++ prioritize performance over correctness
Yes apologies, I misremembered. Mesa is definitely a decendant of Pascal though, more like Modula-2. Very ahead of its time.
grumpyprole··on C and C++ prioritize performance over correctness
> You don't spend "complexity budget" on manual memory management.

Of course you do, especially in applications where there is no benefit to be gained versus using a GC. This is why Java was such a huge success, despite offering very little else over C++ other than GC (I think OCaml is a much better example of a GC language). Consider that an entire book has been written on such details as move semantics. For most GUI apps, a GC or other automatic memory management has proved fine.

> Gnome programs are largely still written in C, but it isn't actually C.

It's still C whatever libraries are used. It's still manual memory management with footguns. This is why they created "Vala".

← PreviousPage 8 of 26Next →