Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Everything Is an X (2020) (lukeplant.me.uk)
34 points by larve on Oct 26, 2022 | hide | past | favorite | 8 comments


Haskell is a relatively poor example of a "Everything is an X" language. There are a lot of different kinds of things in the language that aren't all that uniform. Coffeescript out of all things was more in the "everything is an expression" sort of boat.

Ruby on the other hand is a good example of an "Everything is an Object" language, as it seems to be pretty consistent about that.


Missed one: On a computer, everything is a binary string. It's zeros and ones all the way down.

While I think it simplifies the electrical engineering in that it provides consistency*, I don't think it provides a good interface. The problem is that there are lots of totally arbitrary ways of encoding different objects as binary strings; and lots of nonsense operations you can do on those strings. Maybe the other examples in the list are similar.

I think another relevant quote is: "It's better to have fifty functions over one type, instead of fifty types with one function each."

* - which is the main concern for EEs anyway


On a "functional" lambda calculus computer, everything is a function, including

    0 = \x y. x
    1 = \x y. y
> The problem is that there are lots of totally arbitrary ways of encoding different objects as binary strings

Many different objects do have natural encodings as functions though, such as Church numerals for non-negative integers.


In set theory, everything is a set, including functions.

Weirdly enough, even there, there are reasons to consider different encodings of the same object, like Scott's trick vs Von Neumann encoding.


Previous Discussion:

Everything Is an X (November 12, 2020)

https://news.ycombinator.com/item?id=25078209


I'm usually a big fan of this pattern, but I think one of the biggest examples how not to do it are browsers and the "everything is hypertext" paradigm.

Browser UI still pretends we're in the 90s and every website is mostly text with some hyperlinks intermitted and possibly some fancy formatting using CSS. This is why the only UI primitives a browser presents natively are selecting text, printing and navigating backwards and forwards.

Nevermind that many webpages are sprawling applications by now, which frequently reinvent UI elements and display all kinds of complex entities. But for the browser UI, it's still all just text and fancy formatting.


>Emacs: everything is a buffer.

This was taken from TECO, the editor on which it was prototyped. TECO had 36 Q-registers A-Z,0-9, which are essentially text buffers


I first head "everything is a(n)" in terms of Ruby: "everything is an object."

It's an interesting thing to say in terms of the possibilities you get in that language, even if it is clearly false, think of the assignment operator for example. You can't do something like:

  =.to_str
because = is not an object, it's syntax.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: