HNHacker News
TopNewBestAskShowJobs

magnusjonsson

137 karma · joined May 24, 2009

submissionscomments
magnusjonsson··on Hong Kong Leader Backs Down on China Law But More Protests Planned
The PRC didn't exactly cooperate when the UK wanted to introduce democratic measures in HK well before the handover. https://en.wikipedia.org/wiki/Democratic_development_in_Hong...
magnusjonsson··on Hong Kong Leader Backs Down on China Law But More Protests Planned
China has a lot of vague laws and a history of making up accusations to fit the occasion, with no way for HK judges to examine evidence, and trial with presumption of guilt. This excellent comment on reddit by IosueYu answers the question better than I ever could: https://www.reddit.com/r/HongKong/comments/bvux0z/hong_kong_...
magnusjonsson··on Hong Kong Leader Backs Down on China Law But More Protests Planned
But people elect the parliament and the parliament electthe PM, so it's OK, there's a chain of accountability to the populace. In HK, the parliament has only 70 seats of the 1200-member committee, and only 35 of those are geographical constituents representing the people, the rest are "functional" constituencies mostly representing businesses). Laws have to be passed by a majority of the LegCo however, and the Chief Executive can be impeached by a 2/3 majority in the LegCo, so the LegCo is still very important. The main tragedy is that only 50% of the LegCo is elected democratically.
magnusjonsson··on Thousands take to Hong Kong streets to protest new extradition laws
No, Hong Kong should lead the way.
magnusjonsson··on Learn more programming languages, even if you won't use them
When I started learning Mandarin (my fourth language) I became totally unable to speak French (my third language) as the Mandarin words would pop up first in my mind. I think by now they've been sufficiently separated in my mind but I haven't had any use for my French so it as atrophied anyway. I'm now learning Cantonese which is similar to Mandarin and I'm only occasionally mixing it up with Mandarin. It seems to me the distance between languages isn't so important, you can mix up any two languages or not. It probably depends more on how much your brain has to rewire itself to acconmmodate the new language?
magnusjonsson··on Words for “yes” in Romance languages
Swedish has "nja" (blend of Swedish ja and nej).
magnusjonsson··on Why Does Sweden Have So Many Startups?
That is not what he said.
magnusjonsson··on Does OO really match the way we think (1997) [pdf]
That's an awesome article! Thanks for sharing.
magnusjonsson··on Cello – A library that brings higher level programming to C
Actually those are very bad examples. In practice, compilers will produce warnings in all of those examples.

Better examples (of actually useful things) would be things like designated initializers, struct literals, declaring array lengths in args using static, etc.

magnusjonsson··on Eta – A powerful language for building scalable systems on the JVM
FWIW, the Unsafe class is generally much faster than DirectByteBuffer
magnusjonsson··on Erik Naggum on Attributes in SGML, XML, Lisp (2001)
This does not do away the distinction between attributes and content -- that attributes are flat strings while content can be nested.
magnusjonsson··on OCaml Briefly
You can call it a style if that makes a difference. I think there are reasons behind that style, and I think the too minimal standard library is the main reason. The lack of a good package manager until recently may be another contributing reason.

I hesitate to answer your hyperbole about ten variants of equal signs. It's not uncommon for languages to have two notions of equality like ocaml has (or even more): Here's Python for example: http://stackoverflow.com/questions/132988/is-there-a-differe...

To answer your original question of why anyone would prefer to not use startswith: I don't think anyone does.

magnusjonsson··on OCaml Briefly
It's a problem. Until people have standardized on which 'better standard library' to use, programs will keep building from these too low level building blocks.
magnusjonsson··on OCaml Briefly
The ocaml standard library is minimal to a fault. It's just enough to implement the compiler itself. For higher level operations like starts_with, you use libraries. The Batteries library for example provides what you want:

    String.starts_with line "+++"
magnusjonsson··on Egison: A Lisp Written in Haskell with Advanced Pattern Matching
No syntactic sugar needed. In most lisp pattern matching libraries there are higher level matchers such as "list" etc. Just as the first element of a list is a function or special operator in normal context, in a pattern matching context the first element is a matcher. You can even define new matchers if you want, just like you can define new functions. This makes pattern matching libraries in lisp more powerful than the built-in pattern matching of Haskell and other functional languages.

I just looked at TFA and yes, it's truly awful. It doesn't have to be that way. See e.g. https://github.com/m2ym/optima (a pattern matching library for common lisp). I haven't tried it, but I've tried the predecessor of that library.

magnusjonsson··on Two coffee pots or one?
Just keep your supply of rolls in the bathroom?
magnusjonsson··on The software industry is due for an industrial revolution
What's the software analogy of a factory? Making copies is simple in software so you must have something else in mind?
magnusjonsson··on How to abuse a C++ compiler?
Horizontal space isn't.
magnusjonsson··on Real money, invested with algorithms
(47 choose 39) * 0.5 ^ 39 * 0.5^8 = 0.0000022, so that'd be about 1 in 500000 of all who traded for this long.
magnusjonsson··on Real money, invested with algorithms
Side remark: Please don't use equality and inequality like that. How can a noun and an adjective possibly be equal? They aren't even the same word class. Just use english "is" and "is not" to connect your nouns and adjectives。
magnusjonsson··on A Worst Case for Functional Programming?
The constant factor is huge compared to a straight pointer.
magnusjonsson··on Return-oriented programming
Forth has it right: One data stack and one return stack. Though you could argue that using unsafe languages is the real problem I suppose.
magnusjonsson··on Navy sailors have radiation sickness after Japan rescue
You are both correct. See http://en.wikipedia.org/wiki/Exponential_distribution
magnusjonsson··on The Taxonomy of Terrible Programmers
Suffer can mean "tolerate" sometimes.
magnusjonsson··on For C programmers that hate C++
Hmm, the C code and C++ code aren't even solving the same problem, and they aren't using the same data structures. C++ uses inheritance while C uses a union, for no good reason. What in C++ is struct A : B { } is in C struct A { struct B b; }, not some weird union. Of course unions are not type safe.

And in practice, you can come close to the template solution with a macro for the loop. Sure, it will be a little more explicit about which functions are being called, but that's not a bad thing in my book. And, as with the C++, you'll have to build up the equivalent scaffolding and associated code, which I notice is conveniently left out of the C++ examples.h

magnusjonsson··on Antari breakout
Thanks for waking up the whole family with that blip :(
magnusjonsson··on Tiptop Speakers Launches On Kickstarter
The corner of a room is probably the worst place you can put a speaker if you care about sound quality. The room resonances will be nasty.
magnusjonsson··on [dead]
Paywall. But ironically, if you search via Google you can read the article.
magnusjonsson··on Ignore details early on
I have found simplicity in design and thinking about performance to have a symbiotic relationship. Performance concerns prompt simplifications in the design, and simplicity in design uncovers new ways to improve performance.
magnusjonsson··on Ask HN: Am I missing the Lisp magic?
Imagine unix/C without the ability to create new programming languages such as sh, python, yacc, etc. C would be all you had.

In lisp you can create sh, python, and C, and mix between them freely within a program/function/block with almost zero friction.

By having a simple universal syntax for all your sub-languages, syntax becomes a non-issue. What in unix may be separate language is just a library in lisp.

This is not a water-tight analogy but I hope it illustrates the point. If you want to really understand I recommend actually digging into a language in the lisp family such as Common Lisp, Racket or Clojure.

Page 1 of 2Next →