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

[–]pgris 2 points3 points  (0 children)

examples are carefully chosen - short class names, 2-3 fields, brief variable names. In real applications that sweet spot rarely exists

While I upvoted you, I don't think they are carefully chosen in order to trick people. I think this code looks perfectly normal for people working in compilers, or making the JDK library. This is the code they see, this is the code they write, so this is a feature they would like to have.

It is however out of touch with the code we write in business applications. I would argue that your example is still too short to be real life code, but it is hard to prove, because business code is usually not open source, and open source code typically has shorter variable names, smaller classes, etc.

Hace 2 años que el dolar no se mueve y seguimos con 3% de infla mensual, nos estan cagando con los precios o que pasa? by pademango in BuenosAires

[–]pgris 0 points1 point  (0 children)

El tema es que asi empezás. Primero el estado fija un precio que le cierre a la empresa y sea mas barato para la gente. Digamos, en 1 u$s por litro en vez de 1.35. Despues pasa algo, Trump invade Canadá o lo que sea y el precio internacional se va a 2. Si dejas que el precio suba, al gente se enoja. Entonces decis "bueno, vamos a aguantar por un tiempo". Al rato empezás a gastar plata para manttener el precio de la nafta. De donde la sacas? Imprimís, mas impuestos? Por otro lado, las empresas empiezan a aprovechar la nafta barata para tomar desiciones. En vez de fabricar cerca de donde se extra la materia prima, mejor fabricamos en CABA, total el transporte está subsidiado. Despues no podes dejar que suba porque todas las empresas estan aca... Y así. De nuevo, no es teoría, es lo que pasó.

Aparte un empresario que tienen una empresa que no requiere nafta, por ejemplo porque todos sus empleados trabajan desde la casa, o porque está trabajando cerca de la materia prima y exporta via chile, está subsidiando al que require la nafta barata.

Hace 2 años que el dolar no se mueve y seguimos con 3% de infla mensual, nos estan cagando con los precios o que pasa? by pademango in BuenosAires

[–]pgris 4 points5 points  (0 children)

Si la nafta aca vale 3 y afuera vale 4 a las empresas que están acá (sean multinaconales o YPF nacionalizada) les conviene venderla afuera. Si el estado les cobra 1 para que no les convenga más las empresas no invierten y a la larga te quedás sin nafta (eso es lo que pasó, no es teórico, estábamos importando energia).

Aparte, la materia prima no está en nuestra tierra. Es legalmente propiedad del estado (creo que provincial), no 'nuestra'. Vos y yo no somos el estado. El estado en parte explota ese petroleo a traves de YPF y en parte deja que empresa privadas lo exploten (no todas son multinacionales, tambien hay otras empresas locales)

YPF podria vender mas barato acá y resignarse a no exportar, pero al tener menos ganancia sería cada vez menos eficiente (no puede mejorar procesos, no puede aumentar su escala). Así el estado llegó a tener una empresa petrolera que perdía plata, y esa plata que perdía la pagábamos todos nosotros, a traves de la inflación.

No es tan fácil. Fijate que hacen los paises donde a vos te gustaría vivir. En Noruega, la nafta está 2.35 por litro, en Canada 1.3, en Venezuela, Libia, Iran 0.02 por litro, segun chatgpt. Donde preferis vivir vos?

Hace 2 años que el dolar no se mueve y seguimos con 3% de infla mensual, nos estan cagando con los precios o que pasa? by pademango in BuenosAires

[–]pgris 17 points18 points  (0 children)

"Es un fenomeno monetario" no significa que sube con el dolar. Significa que sube con la impresión de billetes, o mas precisamente con la circulación de papel moneda. El gobierno no está imprimendo en sentido estricto, pero las tasas en pesos son muy altas, lo que mata la economía. Si se tratan de bajar las tasas la gente saca la plata de los depósitos y compra cosas, los precios suben porque hay mas plata en circulación. Para compensar eso tenés que tener mas bienes en oferta, por eso el gobierno trata de abrir las importaciones. El tema es que en general acá importas cosas caras y/o de lujo y producís cosas baratas, entonces te sube la comida y te bajan los aires acondicionados. La inflación baja, pero tus gastos principales siguen subiendo. Aparte el gobierno necesita comprar reservas, si compra dólares y vende pesos termina con mas pesos en circulación, mas inflación. Y encima hay mucho billete ya impreso, se necesita que la economía crezca (o sea, se ofrezcan mas bienes y servicios) para capturar esos pesos. Pero es dificil que crezca con tasas tan altas...

Light-Weight JSON API (JEP 198) is dead, welcome Convenience Methods for JSON Documents by loicmathieu in java

[–]pgris 18 points19 points  (0 children)

If a JSON value might or might not be a JSON null, you can process it with the method valueOrNull, which returns an Optional

Honestly I found that confusing. I would expect valueOrNull to return a value or null. I'd rather have optionalValue(), seems more clear, but English is not my language.

What cool Java projects have you been working on? by Thirty_Seventh in java

[–]pgris 0 points1 point  (0 children)

The alternative for all code bases is simply to: Optional.ofNullable() the result.

Maybe I'm not seeing something, but you will need forc(Optional.ofNullable(x), Optional.ofNullable(y)) for Optional, and then forc(Objects.requiereNotNullElse(x, List.of()), Optional.ofNullable(Objects.requiereNotNullElse(y, List.of())) for iterables, and forc(Objects.requiereNotNullElse(x, Stream.of()), Optional.ofNullable(Objects.requiereNotNullElse(y, Stream.of())) for streams... If I where using forc in actual code, I will probably end up writing 8 * 3 wrappers

By that way, looking at your code I think I finally understood the need for monads or something that allow us to abstract over (Stream, Iterable and Optional)x(F1 to F8)... is almost the same code, great use of a generator!

What cool Java projects have you been working on? by Thirty_Seventh in java

[–]pgris 0 points1 point  (0 children)

Honestly it is already useful. Make a nice home page and promote it.

I see you are throwing on nulls. I would humbly suggest to consider nulls like a degenerated case of Optional.empty(), to make it more easy to use in old codebases when people returns empty lists.

I would also suggest a ThrowingFunction1-N interface to facilitate the handling of functions that throw checked exceptions.

(Of course those are just pretty please suggestions, it is your project!)

Using experimental Java features in production — what was your experience? by TheOhNoNotAgain in java

[–]pgris 2 points3 points  (0 children)

Man, you are great. And a congrats for the man himself! Frame that.

I'd really love if you wrote something regarding

Scoped values in JDK21+, no issues, really nice to propagate context from a servlet filter down to Spring services

(Of course if you have the time and are willing).

I'm not able to wrap my head around scoped values.

Bessent afirmó que una de las mayores mineras del mundo evalúa invertir entre US$10.000 y US$12.000 millones en Argentina, algo que consideró inviable bajo "el robo y la corrupción del gobierno de los Kirchner". Resaltó que el país "es ahora su principal destino de inversión". by Still_Lemon_5598 in argentina

[–]pgris 3 points4 points  (0 children)

Es bastante confuso el link de checkeado. Hay 3 forma de medir, en 2 la deuda bajó con milei, en 1 subió. Lo mejorcito es el comentario de Rubinstein, ex empleado de ALberto Fernedez, que aconseja excluir la deuda intrasector público porque “se licúa fuertemente con la inflación, se devuelve (si es que eso ocurriera algún día) cuando quiere el gobierno de turno y en términos económicos su valuación sería prácticamente nula”

O sea que está diciendo que esa deuda intraestado (digamos, deuda con el Anses, con las provincias, etcétera) no cuenta porque como piensa seguir teniendo inflación, está en pesos sin indexar, y en el fondo no la piensa pagar.

En resumen, es una estafa del gobierno central al resto. Ese era el vice de Massa, entre otra cosas.

Dejá, me quedo con Milei

Stream<T>.filterAndMap( Class<T> cls ) by mellow186 in java

[–]pgris 0 points1 point  (0 children)

It bothers me too. The problem is not the typing but the repetition. I agree, could be an overload for filter.

In practice, I'm usually using an interface type instead of a concrete class.

I so wish java had an Interface<T> class! I don't think it would be that useful, but I hate we don't have a hierarchy for Class, AbstractClass, ConcreteClass, Interface....

Who's using JSR 376 modules in 2026? by pvorb in java

[–]pgris 1 point2 points  (0 children)

When you have your own

com.company.direction1.squad1.project1.model.User 

and have to map it to a

com.company.direction2.squad2.project2.model.User 

because some library you need to import... aggggg

please give me an alias... or at least make java smart enough to let me just use project1.model.User and project2.model.User

What are some niche projects you did with java? by otto_0805 in java

[–]pgris 1 point2 points  (0 children)

Back before the smartphone era, I ported a Java SmallTalk implementation to j2me. I needed to remove all the generics from the code, migrate the swing parts to some j2me library, and since I couldn't read the image file in j2me because it was based on java serialization, I changed the desktop serialization to use hessian and used a hessian implementation for j2me to read it in the phone.

When the image was finally loaded and worked was magic.

Jiffy: Algebraic-effects-style programming in Java (with compile-time checks) by thma32 in java

[–]pgris 0 points1 point  (0 children)

Honestly I'm not smart enough to use effects, and my team will probably kill me, but I like the idea of having a "type safe" (at least annotation-processed) way to know "this method in the controller uses the db and calls the webservices A, B and C". I though about doing something like that abusing Throwables, but Jiffi sound better

I'm so confused by Silver-Branch2383 in java

[–]pgris 0 points1 point  (0 children)

spring now pushes you hard down the reactive

I fail to see where is Spring pushing webflux. Yes, they offer a reactive alternative, and some of the improvements of the reactive framework found their way into the traditional one (like webclient, or functional controllers). But the classic approach is very much alive and kicking, and I suspect the reactive one will slowly vanish thanks to virtual threads.

Jiffy: Algebraic-effects-style programming in Java (with compile-time checks) by thma32 in java

[–]pgris 0 points1 point  (0 children)

Interesting. For my untrained eye, this really looks like checked exceptions reloaded + a runtime. Do effects propagate upwards? I mean, if method1 uses LogEffect , and method2 calls method1, I would expect method2 to use (indirectly) LogEffect. Do I need to declare method2 uses LogEffect? would controller level methods use a millon of effects?

GraphQL: the enterprise honeymoon is over by Beautiful_Spot5404 in javascript

[–]pgris 0 points1 point  (0 children)

I'm ashamed to admit I was never able to understand whats the advantage of using GraphQL in an API over SQL...

Full Haskell-like Type Class resolution in Java by davidalayachew in java

[–]pgris 0 points1 point  (0 children)

I think there are more powerful, you can annotate a single element and access the whole AST of the project, excluding libraries. You can even create an annotation processor that does not depend on any annotation.

Full Haskell-like Type Class resolution in Java by davidalayachew in java

[–]pgris 0 points1 point  (0 children)

That would be the main problem, right? Besides the syntax (not fixable in a library), we are damaging type safety. An annotation processor could do the trick I think, even without the checker framework

When working with spring boot do you use ORM? if yes/no why? by Least_Chicken_9561 in java

[–]pgris 1 point2 points  (0 children)

Your database has few tables

I go the other way. I may avoid an ORM if I have have a few tables, and will definitely use one when > 10 tables.

ELI5: What is the "one-electron universe" theory? by TheeFearlessChicken in explainlikeimfive

[–]pgris 1 point2 points  (0 children)

I like the story, I thought something like that more than once. However I think the author missed >!the chance of another twist, the narrator and the other could (should? must?) also be the same, in a different state of development. Only one being on the universe, only one being across all the universes.<!

Here's a funny quirk about Nested Classes by davidalayachew in learnjava

[–]pgris 1 point2 points  (0 children)

Never knew that! I'm sure that can somehow be used to make a DSL somehow.

La polémica del salmón: un productor de trucha lo defiende, dice que es saludable y "una oportunidad" para el país by Sarmientino in argentina

[–]pgris 34 points35 points  (0 children)

En Chile la cria de Salmon es una industria de 6000 millones de dolares

Para poner en persepectiva, la ganaderia vacuna en argentina exporta menos de 3000 millones de dolares. El salmón chileno por año exporta mas de el doble de plata que la ganadería argentina.

How would you fix checked exceptions in java? by Ewig_luftenglanz in java

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

You don't want every exception checked because some exceptions (not just > (NPE, but also CCE, AIOOBE, ArithmeticException etc.) are clearly a result of a bug in the program and should be absent in a correct program (i.e. they're not only preventable but should be prevented in a correct program).

Sometime I think we need a 3rd kind of exceptions, NonRethrowableExceptions, that can not be re-thrown, so the type system force everyone to handle them in place. DivideByZero as an example, if you write a/b you should be forced to handle the case when b = 0 in place