HNHacker News
TopNewBestAskShowJobs

slashnull

224 karma · joined December 17, 2013

submissionscomments
slashnull··on The abject failure of weak typing
I think what this planet needs is a comprehensive study of how different typing techniques and schools of thought would solve different classes of problems, because what I notice is that

1) definitions are hard, and don't mean much

2) there are many equivalences, and some idioms are conceptually very similar across different type systems, and are just not implemented the same way. For example, a it's a common hobby among FP weenies to show how most of the GoF design patterns are one-liners in their languages of choice.

3) the scope of many typing disciplines is not the same; for example, unityped languages work great for tasks of limited scope with lots of user interface components, functional is historically used to write nice algorithms, and OOP is an attempt at giving a distinct shape to software of very large scope (and it happens to be a pain in the ass when the scope isn't that large)

slashnull··on The abject failure of weak typing
My completely subjective opinion:

OOP is a valid way to write strongly typed code, but there are many useful and common situations that can be solved by some primitive feature found in any good functional language, where the OOP solution is verbose and counter-intuitive.

And that partly explains why so many people bypass the properly designed, strongly typed, object-oriented solution and write shitty code instead.

slashnull··on The abject failure of weak typing
That's cool and all but I think that the point of the article is that the distinction is moot, because they just don't offer anything near the expressive power of algebraic typing.
slashnull··on Haskell, and Why It Might Be My New Favourite Language
A stack of type t things blowing up because of lazyness... How appropriate ; )
slashnull··on Haskell, and Why It Might Be My New Favourite Language
Dynamic typing without the metaprogramming, plus tacked-on parametric typing in the form of templates or generics or whatever they call it. Or better yet: no parametric typing whatsoever and no way of making strongly-typed abstract data structures. Or duck typing, which is exactly that.

Yup, no strong typing anywhere.

slashnull··on Haskell, and Why It Might Be My New Favourite Language
The weirdest thing with the new breed of strongly typed language, in my opinion, is that they naturally accept sum types, which are completely alien from an OOP point of view. I mean, the magnificiently useful case switch feature you have in most of those new languages translates very awkwardly in, say, Java by using a isinstanceof then some kind of cast, which I gather is Considered Harmful because it breaks encapsulation and type safety, yet case switches are a natural consequence of sum types, and are completely safe, in the context of a type system that have sum types.

Switching on "type" also happens to be a thing I see a lot in what one would traditionally consider bad code, for example, treating a scalar and an array differently in PHP, or having functions that can deal with many different shapes and kinds of JSON blobs in JavaScript. There also have been a lot of hype around the idea of eliminating null references by using Maybe types, which in the end are just a degenerate case of a sum type.

My pet theory is that the ability to keep doing this in a safe and formalized manner is what makes the new breed of statically typed PLs so cool.

slashnull··on A Brief, Incomplete, and Mostly Wrong History of Programming Languages (2009)
> Other well known languages in the ML family include OCaml, F#, and Visual Basic.

Every. Single. Time.

slashnull··on Is there really a developer shortage?
Ha!

Reminds me of that time Penny Arcade wanted to hire one person to do 95% of their IT on the cheap, because, y'know, PA is still just two guys making a webcomic, making a bit of cash here and there selling t-shirts and banner ads...

slashnull··on Fix HackerNews Issue #11, which is driving us all crazy: Unknown or expired link
Just making a redirect to the latest front page, or nth page of the latest rendering closure would already much better.

Is there any obvious reason why this isn't done?

slashnull··on Fix HackerNews Issue #11, which is driving us all crazy: Unknown or expired link
this insightful comment is only visible to HN Gold members
slashnull··on Java is the COBOL of my generation and Go is its successor
Go is the new cobol
slashnull··on Capital Man: Thomas Piketty is economics’ biggest sensation and fiercest critic
"The crux of his argument is a deceptively simple formula: r > g, where r stands for the average annual rate of return on capital (i.e. profits, dividends, interest, and rents) and g stands for the rate of economic growth. For much of modern history, he contends, the rate of return on capital has hovered between 4 and 5 percent, while the growth rate has been decisively lower, between 1 and 2 percent. (Piketty makes a compelling case that economic growth, which depends in good part on population growth, is unlikely to accelerate dramatically anywhere but in Africa, given current demographic trends.) Thus he adduces capitalism’s "principal destabilizing force": Whenever r > g, "capitalism automatically generates arbitrary and unsustainable inequalities that radically undermine the meritocratic values on which democratic societies are based."

Now that was fascinating

slashnull··on Nuclear plants release less radiation into environment than coal plants (2007)
"Coal-fired plants emit more radiation in their immediate environment than their nuclear equivalents".

There.

I once tried to find other facts that could support this dumb-ass title, and I was unable to. Coal mining produces a tiny tiny amount of radioactive contamination, and the amount of radiation in fly ash seems to dwarf the amount of radioactive stuff we lose in the nature because of accidents and nuclear waste storage and that kind of stuff.

Even if you state that premise as "coal power has some radioactive waste issues", it's still a lie.

slashnull··on The Birth and Death of JavaScript [video]
ha-zum yavascript
slashnull··on Node.js is Human
I will reply to a completely content-free post with another, mildly less content-free post.

http://widgetsandshit.com/teddziuba/2011/10/node-js-is-cance...

There. Galactic equilibrium re-established.

slashnull··on Ask HN: How do you listen to music while working?
mplayer + zsh globbing, or even find [options] -exec mplayer {} \; but I tend to listen more and more to albums and concert bootlegs and mixtapes on youtube.
slashnull··on Ask HN: Am I one of the few JavaScript programmers who didn't realize this
Yeah, that's a function call.
slashnull··on Neovim
> 2014 > not zsh
slashnull··on The C10M problem
He probably meant that from a TCP point of view, as in there is no way to give a higher priority to incoming TCP connections going into the server than to those going into SSH, even if you could use nice to assign more cpu time to your server.

Or perhaps he meant that the infrastructure used to do multitasking still have to interrupt both his server and SSH, but then described how the kernel can be set to leave some cores free of work then to set the server to use only those and then run absolutely uninterrupted.

Not the only bizarre and confusing statement he wrote, anyways.

slashnull··on The C10M problem
The two bottom-most articles (protocol parsing and commodity x86) are seriously pure dump, but fortunately the ones about multi-core scaling are pretty damn interesting.
slashnull··on Coding tip: Leave your code in a broken state
Better yet:

Vim can save a session via :mksession file_name.vim which can then be restored by vim -S file_name.vim

It's nice when I have to quit programming while in the middle of task where I'm drowned in context spread across multiple tabs and splits. I'm not trying to spread the Vim gospel; this feature is nothing really extraodinary so I guess it's available in other editors/IDEs as well.

Overall this is roughly equivalent to putting your machine to sleep mode while your edition session is still on.

My personal opinion is that both methods make OP's look pretty primitive and hacky.

slashnull··on Ask PG: Is HN Expired Link Eventual Fix Planned?
I was about to post about it.

I would definitely like to see this one sorted out.

slashnull··on Ask HN: Is "Gödel, Escher, Bach" still worth reading?
I have to say I was surprised by that statement, but, thinking of it...

Category theory and Type theory are replacing Set theory as the fundamental basis of Math, or at least it's fashionable to try to do so, and the book revolves around the Whitehead and Russel set theoretic work and Godel's deconstruction thereof. Which isn't to say that Category theory or whatever are immune to Godel's theorems, I have no idea how those would translate, and my gut tells me that they would have roughly the same outcome.

But yeah, anyways, wonderful exposition of the kind of extremely bare-bones framework fundamental mathematicians operate in, magnificient demonstration of what recursive and self-referential structures imply, and overall a great read.

slashnull··on Ask HN: Is "Gödel, Escher, Bach" still worth reading?
The GEB was instrumental in making me a self-conscious and cynical fan of post-modernism and deconstruction, and an avid reader of tales about failure.

I recommend with a side of Neon Genesis Evangelion, David Foster Wallace and Radiohead.

slashnull··on Xkcd: Haskell
I'm in my happy place I'm in my happy place I'm in my happy place where Randall made good FP language comics

http://xkcd.com/224/

slashnull··on Why functional programming?
I would be interested in your views about OOP; it shares some ideals with FP, namely, encapsulation. OOP puts a lot of emphasis on encapsulating state, and binding the associated behavior to it so that no other part of the program can access it and cause problems, and so that contracts can be expressed by clean, abstract interfaces. It also typically uses procedural workflow and algorithmic and adds to it classes as a code organisation paradigm. OOP is boxes; stuff is in boxes so you don't see it.

FP tries to do that but with behavior, so that any given operation can be cleanly plugged into other behavior via function composition and higher-levels such as maps, folds and their math-ey equivalents functors and monads. FP is pipes. Stuff goes in, other stuff comes out, and we have an elaborate system of pipe ends to make sur one's out fits into the other's in.

OOP is good when a lot of persistent state has to hang around; objects in a game, objects floating around in a GUI window, client, transaction, product objects in a commercial application that must be created, viewed, modified, deleted. Boxes in a warehouse, bills and client data in boxes, running and shooting boxes in your Xbox.

FP is good when data has to come in, be transformed, and get out. Text treatment for example. grep is obviously made out of super-low-level procedural C, but it would be a perfect fit for the FP model: a bunch of text comes in, gets chopped into lines, a search algo is performed on each one, and it all gets spitted out, possibly into another, well, pipe. Compilers are also a nice fit: yet some more text comes in, it's chopped into a flat list of tokens, it's parsed into an abstract syntax tree, then into a type-checker, then a few other pieces of optimisation piping, and finally gets spit out as some other lower-level representation.

Server-side scripting is the most common real-life application of functional-ish langs; a request comes in, a few DB requests are made, the return values are chopped into HTML (or whatever mid-level representation then html), and that stuff is spit on the wire, which as far as it goes is isomorphic to a pipe.

Symbolic computing is a pretty sweet match for FP: some notation for an equation comes in, is turned into an expression tree, then into some standard form, then gets solved or integrated or whatever (recursive tree-walks all over the place), then turned back into a human-friendly form and spit back to the display.

Pandoc is a neat Haskell lib that takes some document format (LaTeX, HTML, markdown, whatever), turns it into a unified representation, then spits it back as another format.

JavaScript is funny because it totally embraces the fact that behavior is data, that pipes are also boxes. You give a callback to a handler, which then puts stuff like it as if were a pipe, and then you have functions that implicitly act on a global, implicit data structure (the DOM), some of them that take a description of where does one want to go in the DOM and returns a node of that recursively-defined tree, such that functions can still be chained and it's relevant to do so even if they're mostly used for their side-effects. JS is the weirdest and most wonderful thing. It even has JSON, which is the funniest example of the code-is-data ethos since LISP and it's exposed AST.

But yeah, it's in the nature of FP to not care about state, so it's normal that keeping state around in FP-styled programs is a pain. Passing a global data structure/container to a function that reaches down into the structure and returns a new, modified instance of that global and re-assigning the new into the old is just... Yuck. If a player gets killed in my game state, I want to just delete it from my player list, not replace my player list with a new one.

It's in the nature of OOP to see behavior as a second-class citizen to state. In patterns parlance, FP means using the iterator and the strategy pattern all over the place as they were themselves objects. Just like OOP lets me put two objects together and have a new one, and perhaps put an array of those inside another object. In FP, I can put two different strategies together, and have another strategy, and put that compound in the iterator pattern/strategy, and have another strategy that I can still compound. Recursion (and the oldest FP performance tweak for it, the tco) is a nice way to express iteration without the use of a dedicated iteration construct, which is totally not a nice piece of pipe; you can do function composition by nesting calls [ much(foo(grunk(one_cookie_yum))); ], but it gets weird [ much(foo(grunk_many_cookies(many_cookies_yum))); but you can't do something like {for one_cookie : many_cookies much(foo(grunk(one_cookie)))}; or you could but it would be a built-in construct which you wouldn't have control over, while in haskell you can just do map (much . foo . grunk) many_cookies ]

So yeah.

If you can picture your program like a pipe, it's probably a good fit for FP. The kind of embedded softare you do probably is not remotely looking like a pipe, so you can keep on not understanding FP. If it can provide you some comfort and perhaps a laugh, the legendary pure-functional no-side-fx-allowed the-ghc-actually-is-the-flagsip-project Haskell has a runtime made out of C.

slashnull··on Digital sound processing tutorial for the braindead
This looks fucking cool!
slashnull··on Why isn't server-side web made with XML libs?
Well, yeah, but XML has attributes. I was writing about how that was a problem and so on, but I came up with this

<look attr="at" attr2="up"> this <awkward> problem </awkward></look>

(look (|attr at) (|attr2 up) this (awkward problem))

just by saving "|" as a meta to annotate an attribute pair.

And the weird problem of lone tags looking like unclosed ones magically flies away (I think) since

<script type="text/javascript" src="foo.js" {">", "/>", "></script>"}

is just

(script (|type text/javascript) (|src foo.js))

...sometimes I wonder why isn't everything ever made out of S-exprs.

slashnull··on Ask HN: What new skill or tech you intend to master in 2014?
1) set up a tiny homepage on my home server, create a share on my home LAN, automate my backups, that kind of sysadmin-ey stuff that could be mildly useful on a day-to-day basis

2) get better with Haskell; basically make it replace Scala as my "native tongue".

3) learn more math stuff, especially abstract algebra, type theory, and more category theory as used in Haskell

4) do all right at my internship as a web developer, and get intimate with this nice funky lang that is JavaScript (and get an actual job though that's not a tech skill)

5) learn another lang that will blow my mind with some weird feature. I'm not sure yet; Erlang, J, and more advanced Scheme/LISP/Clojure are possible candidates.

6) find my hipster server-side scripting lang of choice and get decent with it; Node.js and Yesod and two possiblities.

slashnull··on Why isn't server-side web made with XML libs?
I actually didn't know web servers started sending packets before I was done with writing to the stream.

Interesting.

← PreviousPage 6 of 7Next →