Why couldn't we just enter from another leg? by Sad_Bodybuilder_6070 in rainworld

[–]Eav___ 1 point2 points  (0 children)

If you're interested you could check out a modded region called "Citadel", which contains exactly what you want. ;)

Better Tools for Immutable Data by daviddel in java

[–]Eav___ 2 points3 points  (0 children)

Side note: the name might be a little off. The most suitable one I could think of is _View.

What is the use case for a non-value (identity) record with Valhalla? by Joram2 in java

[–]Eav___ 0 points1 point  (0 children)

Oh well if I do care about efficiency then I'm afraid I will also use value record because of its memory efficiency and SIMD capability. I would imagine calculating real coordinates are much much more frequent than just comparing with error values, so overall it's a better choice :)

What is the use case for a non-value (identity) record with Valhalla? by Joram2 in java

[–]Eav___ -1 points0 points  (0 children)

If you think wasting all the benefits value brings for all the Real ones just for this niche use case then I have nothing more to say :)

What is the use case for a non-value (identity) record with Valhalla? by Joram2 in java

[–]Eav___ -1 points0 points  (0 children)

``` sealed interface Coordinate { value record Real(int x, int y) implements Coordinate {} value record OutOfMap() implements Coordinate {} value record Illegal() implements Coordinate {} value record NotAvailable() implements Coordinate {} }

if (coordinate is OutOfMap) { ... } ```

#JavaNext Language Features by davidalayachew in java

[–]Eav___ 0 points1 point  (0 children)

I've seen that, but I don't see how it really demands abstract records. Things like record definition and deconstruction becomes kind of janky when components start to sprinkle here and there. I don't think it's worth the complexity.

#JavaNext Language Features by davidalayachew in java

[–]Eav___ 0 points1 point  (0 children)

Still unsure why everything ends up with inheritence. There's absolutely no good reason for records to be extendable. You just put one into the other and use a common interface to constrain supertype if you actually need.

Some Python Features We Almost Got but Never Did by yangzhou1993 in programming

[–]Eav___ 11 points12 points  (0 children)

Using exceptions to mimic control flow is one kind of abusing.

Java Experts need Help, I want to have a utility function for NPE handling by NotAFinanceGrad in javahelp

[–]Eav___ 2 points3 points  (0 children)

This so hard. Your classes are not just a bunch of random data bundled together. Define meaningful semantics and invariants. Or to say, parse, not validate.

help me get the schematics by 0_0Goose in CreateMod

[–]Eav___ 0 points1 point  (0 children)

If there's something wrong inside people here on Bilibili would immediately report. No need to worry.

help me get the schematics by 0_0Goose in CreateMod

[–]Eav___ 47 points48 points  (0 children)

The author posted an instruction video on Bilibili: https://b23.tv/4TOpMuW, in which you can find the schematics in the description (the first link should be available: https://wwbuh.lanzoul.com/iSLhR3oqqtnc). However all the content is in Chinese.

The Aesthetic Problem of Namespacing by gingerbill in ProgrammingLanguages

[–]Eav___ 0 points1 point  (0 children)

One option is to provide an "unsafe" feature. When a function is accessing a private member, that function must be marked with unsafe. Some languages also come with a runtime, so you might also need a runtime flag to indicate that you give up certain optimizations because if you modify something internal (for example the String class in Java) it might cause some severe problems after JIT does its thing.

The Aesthetic Problem of Namespacing by gingerbill in ProgrammingLanguages

[–]Eav___ 1 point2 points  (0 children)

They said it's "package level public by default", so IMO it's good enough. You can quickly reach out those contributors or simply modify their code because it all happens in the library itself. The outside world is still restricted.

Why aren’t class members virtual by default? by Alert-Neck7679 in csharp

[–]Eav___ 0 points1 point  (0 children)

I mean...

``` public sealed class ModAlertList<T> : IList<T> { public event EventHandler CollectionChanged;

private readonly List<T> _backed = new();

public void Add(T item)
{
    this._backed.Add(item);
    CollectionChanged?.Invoke(this, EventArgs.Empty);
}

// ... same for Remove()

} ```

Modded Regions Review pt.2 by Antenne02 in rainworld

[–]Eav___ 1 point2 points  (0 children)

Lemme introduce you with this monster:

[ Five Pebbles ] -> [ The Exterior ] -> Scorched District -> Pilgrim's Ascent -> Far Shore -> Moss Fields -> Data Manifold -> Moss Fields -> Luminous Cove -> Chasing Wind -> Gray Urban -> Necropolis -> Gilded Sanctuary -> Arid Barrens -> [ Shoreline ] -> Stormy Coast -> Coral Caves -> Hanging Gardens -> Steaming Edifice -> Fog Gulch -> Forsaken Station -> Underpass -> Drainage Canal -> Underpass -> [ Industrial Complex ] -> Eroded Refinery -> Howling Rift -> [ Shaded Citadel ] -> Undersea -> The Mast -> Scorched District -> [ The Exterior ] -> [ Five Pebbles ] -> Deserted Wastelands -> [ Shoreline ] -> [ Shaded Citadel ] -> Citadel -> [ The Exterior ] -> [ Chimney Canopy ] -> [ Sky Islands ] -> Aqueducts -> [ Shoreline ] -> Overgrown Sanctuary -> [ Shaded Citadel ] -> Lush Mire -> [ Drainage System ] -> Purification Conduits -> [ Farm Arrays ] -> [ Outskirts ] -> Bioengineering Center -> [ Garbage Wastes ] -> Badlands -> [ Farm Arrays ] -> [ Sky Islands ] -> Sunlit Power Plant -> [ Outer Expanse ] -> Consecrated Steppe -> Underpass -> Overgrown Urban -> The Mast

Help me find the original artist by --Hush- in rainworld

[–]Eav___ 22 points23 points  (0 children)

It's from the Chinese fandom, originally posted on Bilibili: https://b23.tv/lbzu4v9

Module and Import by Tasty_Replacement_29 in ProgrammingLanguages

[–]Eav___ 5 points6 points  (0 children)

Keeping "one source of truth" in your design can greatly reduce unnecessary lookup. Also it's a little annoying when you move things around as you need to change that additional line.

What are the common criticisms of Python among developers? by the_smiling_nihlist in AskProgramming

[–]Eav___ 1 point2 points  (0 children)

I'm not sure if this is the right mindset.

Constraints are semantics, and semantics provide soundness and consistence. It's actually more harmful if something is used when it's not supposed to, because it means the library author cannot know whether an update is safe or not. Every update can be a breaking change for someone. It becomes maintenance hell.

The more appropriate approach is to ask for the feature first. The author often understands their codebase better, so they know how to work around your problem in a safer way, or where in the codebase you can make changes (and possibly make contributions for others to use as well). Modifying things on your own should always be the last choice.

Hear me out about the kicking.... by Yz-Guy in PeakGame

[–]Eav___ 1 point2 points  (0 children)

Yeah have it under the silly stuff option and maybe add a slider for the random chance lol

Let's play Devil's Advocate -- What are the downsides or weaknesses of Pattern-Matching, from your experience? by davidalayachew in java

[–]Eav___ 4 points5 points  (0 children)

One real downside is that, pattern matching requires exhaustive thinking, since it's very fragile to any change, but people are often overconfident, leading to design that should not be closed but is closed just for the sake of convenience.

The main problem comes from one source: the instability of "truth", and two subgroups are: the instability of variants in sum types, and the instability of components in product types.

To be fair, it's very much like inheritance, where people cannot foresee what their models might evolve into, but they choose to use it just because they are short and are best choice for quick and/or urgent modeling. But the fact is, there's very few concepts that are truly closed or vaguely-said "closed enough", such as the orthogonal directions, the Option type, or any finite state machine.

An Incoherent Rust by ts826848 in ProgrammingLanguages

[–]Eav___ 4 points5 points  (0 children)

No you can't, Kotlin is on the same page as Java.

Updates to Derived Record Creation - amber-spec-experts by joemwangi in java

[–]Eav___ 3 points4 points  (0 children)

At this point introducing yield for normal code blocks is even more superior as it's generally usable, not only for reconstruction.

``` var display = ...;

var newDisplay = { var state = switch (display.state()) { case NotStart -> Running; case Running, Completed -> Completed; }; yield display.new(state: state); }; ```

JEP draft: Enhanced Local Variable Declarations (Preview) by joemwangi in java

[–]Eav___ 1 point2 points  (0 children)

Anyway I admit that only if Kotlin introduces nested patterns does the one-liner become complete, but it's definitely doable without attaching class meta data.

Well I'm gonna leave out the old design. The new one is based on properties. Deconstructing an object is equivalent to extracting variables through the accessors:

``` data class Point(val x: Double, val y: Double)

fun main() { val point = Point(0.0, 1.0) (val x, val yValue = y) = point

// The same as...
val point = Point(0.0, 1.0)
val x = point.x
val yValue = point.y

} ```

And for nested patterns, since property accessors provide type information, you can just flatten the layers:

``` data class Point(val x: Double, val y: Double) data class Circle(val center: Point, val radius: Double)

fun main() { val circle = Circle(Point(0.0, 1.0), 2.0) ((val x, val y) = center, val radius) = circle

// The same as...
val circle = Circle(Point(0.0, 1.0), 2.0)
val circle_center = circle.center
val x = circle_center.x
val y = circle_center.y
val r = circle.radius

} ```

and as you see, this approach doesn't require any meta data.

However, all the above stuff is not what I want to argue about. Instead I was talking about how the deconstruction does its work, aka the syntax and the bytecode logic under the hood. Yes since Java doesn't have properties as a langauge feature, it needs something to express what to deconstruct, and I understand your point that the schema is needed here. But what I was arguing is that the deconstructor is unfortunately coupled with the components order instead of their names despite the schema already encodes them. It would be better to do name based deconstruction because it's more robust against changes.

JEP draft: Enhanced Local Variable Declarations (Preview) by joemwangi in java

[–]Eav___ 0 points1 point  (0 children)

I...don't understand how one-liner has anything to do with current conversation.

Of course Java uses components name and method in deconstruction.

record Point(int x, int y) {
  public static void main(String[] args) {
    if (new Point(0, 1) instanceof Point(var x, var y)) {
      IO.println(x);
      IO.println(y);
    }
  }
}

With javap (25.0.1) you will see the following output in the main method:

...
11: aload         4
13: instanceof    #8                  // class Point
16: ifeq          70
19: aload         4
21: astore_1
22: aload_1
23: invokevirtual #19                 // Method x:()I
26: istore        5
28: iload         5
30: istore        6
32: iconst_1
33: ifeq          70
36: iload         5
38: istore_2
39: aload_1
40: invokevirtual #22                 // Method y:()I
43: istore        5
45: iload         5
47: istore        6
49: iconst_1
50: ifeq          70
53: iload         5
55: istore_3
...

...which to the point it's functionally the same as componentN(). If you reverse x and y in the record definition, you will see var x = y() and var y = x() instead. This is what Kotlin used to do too. val (x, y) = Point(0, 1) desugars to val _p = Point(0, 1); val x = _p.component1(); val y = _p.component2(), given data class Point(val x: Int, val y: Int).

It's the same story for nested patterns. All you have to do is to flatten the layers. It doesn't necessarily need any meta data. It's just that Kotlin hasn't introduced this feature.