Better HN
topnewbestaskshowjobs
Log inSign up

grumpyprole

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

Submissions

comment 8y ago · link · parent

I think the point was that recursion makes a better foundational primitive. For example, with Java and C#, their (somewhat arbitrary) Iterator and IEnumerator library interfaces are baked into the syntax of the language (e.g. the foreach loops). This is not a good position to be in.

comment 8y ago · link · parent

I respectfully disagree that Web Assembly really "exposes the underlying machine capability" in any meaningful sense. The situation we are in today, is that many assembly ISAs are no longer fit for purpose. A modern C compiler will spend a lot of work recovering data-flow dependencies (e.g. SSA form) only to then remove them when outputting e.g. x86 assembly. The CPU then has to recover much of this information again for out-of-order execution etc.

IMHO, the Web Assembly folks should focus on a simple, elegant core language that is easy to define and easy for a JIT to optimise. The machine architecture, whatever that may be now or in the future, should be secondary. Personally, I would never have called it "Web Assembly" either.

comment 8y ago · link · parent

What's wrong with hibernating and suspending? It's been two months since I last rebooted my Linux laptop, I typically only do it when upgrading the kernel. I agree it would be nice to keep session state after a reboot, but it's a very minor annoyance. Some window managers such as i3, do at least let one persist window configurations.

comment 8y ago · link · parent

Weight is not the same as thinness. The X1 Carbon is substantially lighter than the MacBook Pro, but with a much better keyboard and much more repairable.

comment 8y ago · link · parent

> you cannot use subtype polymorphism to have a heterogeneous list of objects

You can by using an existential type parameter, which 'forgets' the types in much the same way as an upcast.

[exists p. {x:int; p}]

comment 8y ago · link · parent

Well not really as row polymorphism is a form of structural typing.

comment 8y ago · link · parent

A consequence of this is that the language has many severe limits. For example, number of function parameters, number of local variables, amount of code inside a conditional branch etc. Working around these limits can often feel like being a human-compiler.

comment 8y ago · link · parent

But the problem of correct program construction does not go away. There is certainly a middle ground somewhere, beyond which proofs become too expensive for most users. For the sorts of systems I work on, the sweet spot is close to Haskell 98, for others it may well be Python (no types at all).

comment 8y ago · link · parent

IMHO, structural types are a better starting point. Nominal types can always be created by wrapping a structural type, but it is difficult to go the other way round. A language with row types can give a type to a query or have named function arguments. Extensible row types allow even more forms of composition, for example functions that require the presence of certain fields but will ignore others, very similar to subtyping.

comment 8y ago · link · parent

I thought your comment was specifically about co/contraviance in type parameters with subtyping, because industry has explored the idea of making this unsound (e.g. the Google Dart team). But yes, co/contravariance pops up everywhere and so an unsound type system (or no type system at all) is not the answer. We had best all understand it!

comment 8y ago · link · parent

You are I think making a comment about type parameters in object-oriented languages with subtyping? But why give up on static types so easily? How about a type system without subtyping (e.g. Haskell, OCaml) or even better one with structural row typing (e.g. OCaml, Purescript, Elm)?

Type systems are a form of machine-checked proof of correctness, at least for certain classes of errors. Sometimes proving things is laborious and a pain, but it is worth it if one cares about correctness (and often less effort than writing more unit tests).

comment 8y ago · link · parent

Haskell does make a great semi-formal language with which to communicate functional programming ideas, even if you have no plans to ever use an implementation of it. Mainstream languages are beginning to borrow more and more ideas from it (albeit often with significantly more verbose syntax). Much of the research literature in functional programming also uses Haskell syntax, so IMHO it is worth any developer learning.

comment 8y ago · link · parent

Yes I am aware of this. It is explained very well in the tutorial paper "Practical type inference for arbitrary-rank types" : https://www.microsoft.com/en-us/research/wp-content/uploads/...

comment 8y ago · link · parent

Of course C#, because of subtyping, also has contravariant type parameters (unlike Haskell). The variance phenomena shows up in many places.

comment 8y ago · link · parent

Standardised principled abstractions make for better program composition and better API design. In the Haskell world, APIs are much less adhoc, more consistent and easily understood because of such mathematical abstractions (and the laws they imply, relating operations). Principled abstractions enable many other possibilities too, such as automatic program derivation. In Haskell I do not need to write any code to aggregate nested maps or parse a sudoku board, the compiler knows how to assemble such code automatically from the types.

comment 8y ago · link · parent

I can certainly see merit in that idea. The problem is that it's often not clear what the idiomatic style for a particular language applied to a particular problem is. Many of the Haskell solutions also look quite old, predating for example the now standard Haskell "Vector" library.

It's a useful resource, but I think we should we wary of making very general remarks based on the results.

comment 8y ago · link · parent

My post was more for the benefit of other readers, who might have otherwise concluded that modern GHC is "slow". There are many ways to compare the 'execution time' of e.g. Java and Haskell. Idiomatic Haskell code may well be slower than (traditional) idiomatic Java code. But these days more and more functional code is written in Java/Scala/Clojure and the JVM does not optimise such code nearly as well as GHC.

comment 8y ago · link · parent

Those benchmarks do not compare like-for-like. Often the Haskell versions try to solve the problems elegantly with high-level functional code at the expense of performance, e.g. see Mandelbrot.

GHC Haskell is an advanced optimising compiler that will produce considerably faster functional code than both Erlang and Java. For maximum performance, it is perfectly possible to write imperative array-oriented code in Haskell, in which case performance should be comparable to Java.

comment 8y ago · link · parent

A feature I would like to see in a mobile OS is per-process power quotas.

comment 8y ago · link · parent

If we had better languages and tools for integrating various parts of the tech stack, then perhaps we wouldn't need such monolithic constructions. See the Mirage unikernal project for an alternative to containers and virtual machines running full blown operating systems.

comment 8y ago · link · parent

Note the above is not totally correct, LINQ-to-SQL can be used as an ORM if required (i.e. is not restricted to one-to-one mappings from tables to classes).

comment 8y ago · link · parent

I suspect that GraphQL corresponds more to Erik Meijer's "coSQL" formalism (see A Co-Relational Model of Data for Large Shared Data Banks). The advantages with respect to SQL would be an open-world assumption (easier distribution, no normalisation), the disadvantage would be the lack of arbitrary joins (which requires normalisation and indexes).

comment 8y ago · link · parent

> I can't help but think that you are using GraphQL in a way for which it was not designed.

The confusion exists because nothing even remotely formal appears to have been written down or documented. I can only find references like "a query language", which tells all of us very little.

comment 8y ago · link · parent

The food industry needs a lot more regulation IMHO. It often misleads the consumer with its marketing, but a cereal or juice drink is not healthy when it's rammed full of sugar.

comment 8y ago · link · parent

This only makes sense for software that you use frequently and don't mind repurchasing everytime Apple breaks them with OSX upgrades.

comment 8y ago · link · parent

The power to reason is limited in complex languages.

comment 8y ago · link · parent

From the article: "Canonical can deliver an OpenStack platform to an enterprise in two weeks with everything in place."

comment 8y ago · link · parent

Unfortunately Apple hardware is not particularly well supported by Linux.
1
424344
69