News for hackers. Stuff that matters.

zarakshR

Re:Attention people who think UB is fine on Sunday October 25, 2026 @01:20AM (#50228571)
Re:Rat's Register Allocator on Sunday October 11, 2026 @08:35AM (#50042622)
Not quite, SSA form makes only the colouring pass polynomial time, optimal choice of spilling and coalescing is still NP-complete. cf. https://hal-lara.archives-ouvertes.fr/hal-02102286v1/documen...
Re:Why I Still Reach for Lisp (& Scheme) Instead of Haskell on Wednesday April 29, 2026 @05:33PM (#47955038)
I don't see how:

Racket:

  > (define (fact n)
      (if (= n 1)
          1
          (* n (fact (- n 1)))))
  > (fact 6)
  720
OCaml:

  # let rec fact = function
      | 1 -> 1
      | n when n > 1 -> n * (fact (n - 1))
    in fact 6;;
  - : int = 720
Re:Baking the Y Combinator from Scratch on Wednesday April 09, 2025 @07:20PM (#43639040)
This is not relevant since this de-sugaring cannot be performed if `name` is recursive (i.e., if `term` refers to `name`), which `Y` is. So the author's derivation is still required in the pure lambda calculus.
Re:You Need Subtyping on Saturday March 29, 2025 @09:52AM (#43515547)
> because PHP and Javascript will implicitly convert back and forth

If you can provide (valid!) methods `T -> U` and `U -> T` for two types, why wouldn't `T = U` hold? (Atleast for types where `=` makes sense)

This is the definition I am using:

> S is a subtype of T, written S <: T, if a value of type S can safely be used in any context where a value of type T is expected.

from Pierce's "Software Foundations"

Of course, you may not want to make `String <: Number` and `Number <: String` (and thus `String = Number`), because there is no sensible way to do so; but this is an issue with the way PHP/JS handles subtyping, not with the notion of subtyping itself and certainly does not apply to the example of nullable types.

Unfortunately, I am not familiar enough with C++ to comment on the other question, sorry!

Re:You Need Subtyping on Saturday March 29, 2025 @07:28AM (#43514619)
> The point is you can't simply treat non-nullable as a subtype of nullable in general, because this case exists.

But surely, you can still use subtyping in other cases -- when it is already unboxed -- right?

Like so: `T <: T?` for all boxed `T`.

Re:You Need Subtyping on Saturday March 29, 2025 @06:57AM (#43514452)
> The language can just have an implicit conversion rule for convenience

the presence of an implicit conversion rule `T -> T?` amounts to the observation that `T <: T?`, where <: is the subtyping relation

> make an unboxed integer nullable ...

I don't think any language allows this, in any case disallowing nullability for unboxed types amounts to the observation that `P !<: P?`, where !<: is "does not subtype"

I believe (unless I have misunderstood you) that both your examples are subsumed (heh) by subtyping

Similarly, I was shocked to learn that models of aeroplanes don't even account for the possibility of the plane being blown up mid-flight by a stray anti-air missile.

It seems aerospace engineers are just like priests and counselors in the courts of ancient kings.....

Continuation-passing style?
> If I am in my normal raw intellect, I will begin going deep on some topic thats outside the range of normal human discourse. It will be hard for me to stop, because of my interest. Alcohol removes that to a large degree.

Peak HN.

Re:The Go language's first commit (1972) on Monday February 14, 2022 @03:43AM (#30329720)
How would that even work if git was released in 2005? Am I missing something?
Re:Write it in Garamond on Wednesday February 02, 2022 @04:02PM (#30184015)
And EB Garamond[0] if you want a free font.

[0] - https://fonts.adobe.com/fonts/eb-garamond

Re:Apple Reports Third Quarter Results on Tuesday July 27, 2021 @06:36PM (#27978490)
I can't wait for this comment to show up on n-gate.com
Wow, this is really helpful. Thank you!

Ask HN: Quick and high-level tutorials for Python – or any other language?

I'm thinking of learning Python but all the tutorials that I can find are cookie-cutter SEO'd tutorials on Google.The main issue I have with these is that they are more geared towards beginners and focus on things like what ints/floats/strings are and what functions are etc,etc,, Is there a place where I can get a quick-and-dirty overview of the language that are geared towards people who are...

( Read More... | 3 comments | 2 points | on HN )
Re:Seasteading Creates RPG on Tuesday June 08, 2021 @06:28PM (#27441905)
Under the description of The Co-Op it says "Players pay a membership fee to access resources like food, lodging, clean water, etc."

Did anybody think this through more than once?

Re:Minims on Sunday June 06, 2021 @07:01PM (#27417158)
This is such a poorly made website. I love it!
>It's a lousy argument to suggest that Chinese products are bad because Chinese culture does not promote attention to detail...

I would just like to point out that the GP did mention,

>...not culturally specific to Chinese...

Re:Please stop sharing lines of code on medium.com on Tuesday April 06, 2021 @02:37AM (#26708694)
The selection does not disapper if it ends on a parenthesis or whitespace. Odd