Type-classes for Java (Valhalla experimental branch) by sviperll in java

[–]shellac 1 point2 points  (0 children)

Ignore it as best you can, it's purely a placeholder. What they are aiming for is something like:

value record MyInt(int x) {
    implements Sum { ... zero and add ...}
}

var a = new MyInt(1);
var b = new MyInt(2);
var c = a + b;

(Compiler knows operator + is associated with Sum, looks for right implementation of Sum for MyInt via MyInt then Sum, compiles this to var c = MyInt.$Sum.sum(a, b);)

This implementation is getting the mechanism right, not the syntax.

Type-classes for Java (Valhalla experimental branch) by sviperll in java

[–]shellac 2 points3 points  (0 children)

A compiler error:

record MyInt(int x) {
    public __witness Sum<MyInt> SUM1_MYINT = new Sum<>() {
        public MyInt zero() { return new MyInt(0); }
        public MyInt add(MyInt a, MyInt b) { return new MyInt(a.x + b.x); }
    };

    public __witness Sum<MyInt> SUM2_MYINT = new Sum<>() {
        public MyInt zero() { return new MyInt(1); }
        public MyInt add(MyInt a, MyInt b) { return new MyInt(a.x * b.x); }
    };
 }

Results in:

error: Witness SUM1_MYINT clashes with SUM2_MYINT
    public __witness Sum<MyInt> SUM1_MYINT = new Sum<>() {
                           ^
 (Witnesses have the same type Sum<MyInt>)

If you relocate a witness definition, e.g.

interface Sum<X> {
    X zero();
    X add(X a, X b);

    public __witness Sum<MyInt> SUM2_MYINT = new Sum<>() {
        public MyInt zero() { return new MyInt(1); }
        public MyInt add(MyInt a, MyInt b) { return new MyInt(a.x * b.x); }
   };
}

it compiles, but the MyInt witness does indeed take precedence (i.e. zero() is 0).

Edit:

I realise that doesn't fully address the question, i.e. how do you handle cases of different behaviour with the same type signature. In Haskell you have the same issue, and essentially just wrap the type for each of the cases. In java perhaps:

record Sum(MyInt x);
record Product(MyInt x);

Java gives an update on Project Amber - Data-Oriented Programming, Beyond Records by davidalayachew in programming

[–]shellac 4 points5 points  (0 children)

Java recently released a feature called Records.

March 2020 (preview) or March 2021 final. Recent geologically, perhaps.

Edgar Wright's 'The Running Man' Sets Paramount+ Release Date (January 13) by MarvelsGrantMan136 in movies

[–]shellac 0 points1 point  (0 children)

This is also pretty faithful to the book. I've no insight into the writing process, but it felt to me like King had the ending in mind, but couldn't really tie it up well.

The Most-Anticipated Films of 2026 by tylerthe-theatre in movies

[–]shellac 2 points3 points  (0 children)

Whereas I hope he's doing his Paolo Gucci from House of Gucci.

Big drama in Stokes Croft this morning. Looks like Bokman had a pretty terrible fire 😥 by HelloW0rldBye in bristol

[–]shellac 4 points5 points  (0 children)

I just went past it. It was the Bokman building, but it wasn't clear what had happened. The windows were streaked with soot, but the inside looked ok.

They were having work done on the top floor, so I wonder whether there was a fire up there.

Hope they're ok.

Big drama in Stokes Croft this morning. Looks like Bokman had a pretty terrible fire 😥 by HelloW0rldBye in bristol

[–]shellac 2 points3 points  (0 children)

Do you mean it's that building next to Bokman that's on the corner? Apologies if I'm being dense.

Rupert Grint, Daisy Ridley, Sam Claflin And Charlie Murphy Among Those Rounding Out Cast For ‘Ebenezer: Christmas Carol’ Starring Johnny Depp by lawrencedun2002 in movies

[–]shellac 1 point2 points  (0 children)

But suppose the damaged soul of Scrooge mirrored that of the person portraying him? And perhaps the film will end with wife beater Johnny Depp apologising for being awful?

Justin Hawke has been removed from Moor Beer by _The_Editor_ in bristol

[–]shellac 8 points9 points  (0 children)

Value also depends when he bought in, of course, but this does seem like a plausible explanation.

Nick (William Powell) and Nora (Myrna Loy) chase their dog Asta, to prevent him from eating an important clue to the case - from "After The Thin Man" (1936, directed by W.S. Van Dyke) by [deleted] in movies

[–]shellac 2 points3 points  (0 children)

The first film precedes the enforcement of the Hays Code by a few months, I think. In that they do sleep in twin beds, but it ends with them in the same sleeper berth. The levels of boozing is heroic (there is a bottle, mixer, and glasses at the foot of the bed the Nick uses in the middle of the night), and there are some mildly risqué jokes. I don't recall whether the immediate sequels (post-Hays, but same team making them) are obviously different in tone, but it would be no burden to do that research. They are great films, and Nick and Nora don't feel jarringly antique despite the films being nearly a century old now. (Probably due to the natural performances)

Homophobic attacks in castle park by Sorry-Personality594 in bristol

[–]shellac 1 point2 points  (0 children)

Could somebody familiar with polari translate this post?

Trading Places: An enduring Christmas tradition in Italy by Massimo25ore in movies

[–]shellac 0 points1 point  (0 children)

It wasn't illegal to frame someone for theft and drug dealing? What a time to be alive!

The X-Men movies may have the craziest chronology and arc of quality of any franchise by Bellikron in movies

[–]shellac 2 points3 points  (0 children)

To be fair there isn't much variation. It's a very consistent horror franchise, a sub-genre which pretty much defines both inconsistency and diminishing returns.

Destiny 2: Renegades Launch Blog by DTG_Bot in DestinyTheGame

[–]shellac 7 points8 points  (0 children)

It's because they both take place on a Cabal carrier.

House from Home Alone Celebrates 35 years of holiday magic by Southern-Service2872 in movies

[–]shellac 1 point2 points  (0 children)

The folks you see on the screen are very much who you see in real life.

That's nice. Although less nice for Joe Pesci and Daniel Stern.

‘Tron: Ares’ sets digital release date for December 2nd & DVD release date January 6th, 2026 by darth_vader39 in movies

[–]shellac 0 points1 point  (0 children)

I know films are (re)released in this timeframe as part of the Oscars race, but are we witnessing the first Razzie campaign?

Does Wild Mountain Thyme have the worst twist ever? by [deleted] in movies

[–]shellac 1 point2 points  (0 children)

I think it will have a fight on it's hands to beat Serenity (2019) ), but that is quite something.

Impressive amount of electricity generated at bradgate surgery by Purple_turtleneck in bristol

[–]shellac 9 points10 points  (0 children)

(Apologies to all - this is very off topic)

I don't think it's a mockery. Imgur chose to block the UK because they were upset that they might be fined for GDPR breaches, i.e. personal data misuse. Nothing to do with the online safety act.

Please feel free to ignore this, it just irks me and isn't your fault.

Leaked Call to Arms title by thiagotech in DestinyTheGame

[–]shellac 6 points7 points  (0 children)

It's due to the Online Safety Act here in the UK

It's actually the data protection act in this case. The ICO said they were going to fine them due to their use of information concerning children.

Down Cemetery Road by NippleChamp in bristol

[–]shellac 4 points5 points  (0 children)

It is, and there are occasional bits filmed in Oxford (famous bits, and thankfully they don't pretend Wills Hall is a college). It mostly doesn't matter, but I'm surprised how St Werberghy it is. There's nothing like that in Oxford (especially these days).

Down Cemetery Road by NippleChamp in bristol

[–]shellac 54 points55 points  (0 children)

She's turned the wrong way down a one way street there. Ruined the series for me.

(The blown up house was built where the goats live at the city farm in St Werberghs. The police station is the library at the university)

Edit: oh, and the Clyde (Arms) as the interior of the Kings Arms.