HNHacker News
TopNewBestAskShowJobs

mcaruso

165 karma · joined November 12, 2009

submissionscomments
mcaruso··on PHP 8.5 adds pipe operator
People use method chaining all the time and don't have any issue with it? It's equivalent to something like:

    $result = $arr
        ->column('values')
        ->merge()
        ->reduce(fn($carry, $item) => $carry + $item, 0)
        ->repeat('x');
I think this just comes down to familiarity.
mcaruso··on JavaScript dos and donts Mu-An Chiou
> Where's our OOTB carousel, date picker, rich drop-down with icon/subtext, form elements supporting AJAX state, modal windows? etc etc.

You might want to take a look at what browsers have been working on lately, because a lot of what you're asking is either already here or actively developed. Some of it driven by the Open UI working group (https://open-ui.org).

- Modal: see the <dialog> element, with its focus trapping out of the box, stylability through the top layer, entry and exit animations through @starting-style and the ability to transition discrete properties like `display`, etc.

- Rich dropdown: browsers now support popovers, which allow you (without any JS) trigger a popover that overlays the screen in the top layer, and with automatic focus management. See also the work being done on stylable <select> elements, there's a great episode of Off The Main Thread that goes deep into all the work being done to make this happen [1].

- Carousel: see the recent work on stylable <details> elements [2], and in general the carousel project at Open UI. After <select>, the carousel is one of the main focus areas.

[1] https://offthemainthread.tech/episode/stylable-select-elemen...

[2] https://chromestatus.com/feature/5112013093339136

[3] https://open-ui.org/components/carousel.research

mcaruso··on HN's HTML Is Invalid
Of course HN works fine, if it didn't work fine it'd be fixed by now. "Working fine" is an extremely low bar for any site. As a developer you will still want to avoid quirks mode because it just makes your life harder for no reason.
mcaruso··on Abstraction: Not what you think it is
From the article:

> But we've had a pretty good definition of abstraction since 1977, originally in the context of program analysis, and — I claim — it actually translates quite well into a precise definition of “abstraction” in engineering.

So I don't think the author is saying that all these other people are "wrong", but rather that this one particular definition seems to capture the underlying essence of what we intuitively think of when we say "abstraction", and the rest of the "hodgepodge of different concepts" break down if you analyze them a bit deeper (as the author did in the "Not Abstraction" section).

mcaruso··on Fetch API has landed into Node.js
Node supports ES Modules (the import statements you mention) natively now: https://nodejs.org/api/esm.html
mcaruso··on A pipe operator for JavaScript: introduction and use cases
=> also comes straight from math learned in school. There it's written → (for function signatures), and (the more rare) ↦ for function definitions.
mcaruso··on Semver doesn't mean major.minor.patch, it means fails.features.bugs
0.x releases are also major versions according to semver, just pre-stable. So many people were referring to React 0.x releases as "React x" that they just bumped it straight to version x.
mcaruso··on Functools – The Power of Higher-Order Functions in Python
Lambdas are constrained by their type. If you see a lambda being passed to, let's say `map`, then (assuming you know the type of `map`) you know the type of the passed lambda.

Of course this assumes the lambda is pure, but in the kind of code we're talking about (pseudofunctional code with lots of higher-order functions) they should be pure for the most part.

mcaruso··on Koka: A Functional Language with Effects
Was just pointing out a nice (probably unintentional) pun
mcaruso··on Koka: A Functional Language with Effects
> (all _effect_ively research languages)

:)

mcaruso··on The Black Hole Information Paradox Comes to an End
The title probably changed. The URL slug still has "comes-to-an-end".
mcaruso··on Generalizing 'jq' and Traversal Systems using optics and standard monads
Let's take a look at how we might write a function like `map` the (pure) functional way in a language like JS:

    const head = ([x, ...xs]) => x;
    const tail = ([x, ...xs]) => xs;
    
    const map = (list, fn) => {
      if (list.length === 0) {
        return [];
      } else {
        return [fn(head(list)), ...map(tail(list), fn)];
      }
    };
    
    map([1, 2, 3], x => x + 1); // [2, 3, 4]
We're not keeping track of any state here. Using recursion you don't need to keep track of the current element in the list for example (when you run this on a physical machine it will of course, but not at the conceptual level).
mcaruso··on Roof blows off new Tesla Model Y
I'm reminded of this classic sketch: https://www.youtube.com/watch?v=3m5qxZm_JqM
mcaruso··on Concatenative Programming; the Free Monoid of Programming Languages (2019)
The ASCII art text? There's a link in the top comment there: http://www.patorjk.com/software/taag/#p=display&f=ANSI%20Sha...
mcaruso··on In Further Praise of Dependent Types
> Is a gymnasium a school in Europe? It's an exercise facility in the USA.

https://en.wikipedia.org/wiki/Gymnasium_(school)

> I've gone through high school and taken CS (and a bit of discrete math and logic) in college, and never seen the ⊢ symbol before.

Interesting. I was taught ⊢ first semester in CS in Logic class. Along with most other common logic notation.

mcaruso··on A Pythonista's Review of Haskell
I'm a JS dev that learned Haskell over the past few years. Anything in particular you're curious about?

I guess if I were to mention one thing I really miss in Haskell it's having easy, generic dictionary types a la JSON. Give me some syntax sugar to write a dictionary like JSON objects, where the properties are ordered by insertion (unlike most HashMaps that are unordered or rely on some predefined Key ordering). Also I'd love some better record types.

mcaruso··on Nintendo’s iconic logo escaped an “age-up” remake
"Demanding" anything from a superior is a bit of a no-no in Japan, even if it's something as simple as a phone call.
mcaruso··on Simple Rules ‘Bootstrap’ the Laws of Physics
Not a physicist by any means, but from the article it talks about gravity in the context of the graviton (as one plausible solution to the problem mentioned). Which is still hypothetical, so it's not like they've proven gravity from first principle or anything.
mcaruso··on React Table is a “headless” UI library
It's a React component for data tables. So it implements (re)loading data, sorting, pivoting, and the other stuff mentioned in this feature list:

https://github.com/tannerlinsley/react-table#features

So the comparison to HTML tables is a bit odd, because (as per the article linked by OP) it does pretty much everything except the UI part.

(I'm not the author, I just use this library at my work.)

mcaruso··on CDuce: XML-oriented functional language
That moniker should probably go to E4X:

https://developer.mozilla.org/en-US/docs/Archive/Web/E4X_tut...

mcaruso··on TypeScript 3.7 Beta
`const` variables are actually inferred without widening. So in your example `dir` would be inferred as `"up"`, not `string`. If you use `let` (or `var`) however that would be true.
mcaruso··on Alan Kay's answer to ‘what are some forgotten books programmers should read?’
> The way to grow from this book is to deeply learn what they did and how they did it, and then try to rewrite page 13 in a number of ways. How nicely can this be written in “a lisp” using recursion. How nicely can this be written without recursion? (In both cases, look ahead in the book to see that Lisp 1.5 had gotten to the idea of EXPRs and FEXPRs (functions which don’t eval their arguments before the call — thus they can be used to replace all the “special forms” — do a Lisp made from FEXPRs and get the rest by definition, etc.).

Found it ironic that in a comment about Lisp, Kay forgot to balance his parens. :)

mcaruso··on Greenland Lost 12.5B Tons of Ice in a Single Day
I don't think you know how the IPCC works. They're not some vegan activist group. It's an internationally appointed group that studies scientific consensus to inform policymaking. From the report (https://www.ipcc.ch/2019) you mentioned:

> The Intergovernmental Panel on Climate Change (IPCC) is the UN body for assessing the science related to climate change. It was established by the United Nations Environment Programme (UN Environment) and the World Meteorological Organization (WMO) in 1988 to provide policymakers with regular scientific assessments concerning climate change, its implications and potential future risks, and to put forward adaptation and mitigation strategies. It has 195 member states.

> IPCC assessments provide governments, at all levels, with scientific information that they can use to develop climate policies. IPCC assessments are a key input into the international negotiations to tackle climate change. IPCC reports are drafted and reviewed in several stages, thus guaranteeing objectivity and transparency.

> The IPCC assesses the thousands of scientific papers published each year to inform policymakers about the state of knowledge on climate change. The IPCC identifies where there is agreement in the scientific community, where there are differences and where further research is needed. It does not conduct its own research.

> To produce its reports, the IPCC mobilizes hundreds of scientists. These scientists and officials are drawn from diverse backgrounds. Only a dozen permanent staff work in the IPCC’s Secretariat.

mcaruso··on Nearly all mass shooters have four things in common
> The Netherlands has strict gun control and still has mass shootings.

I can think of two in my lifetime. The one you mentioned in Utrecht, and the Alphen aan den Rijn one in 2011. Even accounting for population size it's nowhere near the severity/frequency of the US.

> Gun control did nothing to stop that.

Gun control obviously isn't going to stop every attack. That doesn't mean it can't prevent many of them.

mcaruso··on Terminating Service for 8Chan
Agreed! If a conscious decision is being made to value the ability for people to own guns in expense of frequent killings then go for it.

But it's usually phrased as "there's nothing we can do" and gun control wouldn't help, which is dishonest.

mcaruso··on Terminating Service for 8Chan
> other countries don't have 2nd amendment in constitution

Changes to the constitution can and do happen. And it's kind of beside the point anyway because a degree of gun control already exists in the US without being in conflict with the constitution.

> US doesn't pretend to be the same as all the other countries

Clearly. You're also the only one where this is such a problem.

mcaruso··on Terminating Service for 8Chan
I feel like you're taking the wrong conclusion here. Perhaps modern society and guns being widely accessible don't mix. Other countries took measures when the problem became apparent, the US didn't.
mcaruso··on Dhall: A Non-Repetitive Alternative to YAML
I don't really see why the author needs to justify it. New languages with new syntax come out all the time, some become popular some do not. Sometimes a new language comes out with a different syntax and becomes popular, creating a new norm.

But in any case Dhall does actually follow a norm rather closely, just a different norm than the grandparent is used to. Namely, ML and other functional languages/research. Which makes sense since Dhall is a product of that community.

mcaruso··on Dhall: A Non-Repetitive Alternative to YAML
Seems like you're criticizing it just because it's different from what you're used to.
mcaruso··on Entropic – A Federated Package Manager for JavaScript
> They keep whining that Roald Dahl is miserable and all despite inventing Node

I think you mean Ryan Dahl haha

Page 1 of 2Next →