programming_horror

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

nrabulinski, in my react frontend crashed with Segmentation faults

That’s not a segfault, that’s a bus error, which also refers to memory, but it’s a different kind of error, typically occurring when you access a misaligned address or some address which cannot possibly be referenced. Probably a problem with one of the pre-built binaries some npm module ships

Blamemeta, in my react frontend crashed with Segmentation faults

Well thats just impressive.

peopleproblems,

The only thing that I came to the conclusion of was: “not whatever you are doing.”

EatBorekYouWreck, in Curly bracket chain

Ah, modern web development.

thisisawayoflife, in my react frontend crashed with Segmentation faults

Do the tests run? What was the last change you made before it started crashing?

_brian,

fresh new project so no git history .i just copy pasted few configuration files (from my personal boilerplate.) and install all the node modules.i’m guessing some package was missing or something.

Macil, in Programming HTML in Rust may have annoyed some gods.
@Macil@programming.dev avatar

This looks like how React components are written if you make the weird choice of not using the JSX syntax extension for React elements. I wonder if you could make a JSX-like DSL with Rust macros. JSX really helps for making this kind of stuff bearable.

autokludge,
@autokludge@programming.dev avatar

after a quick search … github.com/bodil/typed-htmlalso leptos uses something similar

Hexarei, in Programming HTML in Rust may have annoyed some gods.
@Hexarei@programming.dev avatar

Web development is, and will always be, just a game of finding increasingly cursed unique ways to concatenate HTML strings

cadekat,

One day I’ll find a reason to use https://docs.rs/yew/0.20.0/yew/macro.html.html. One day.

o11c,

The problem is that what everybody really wants is parameterization, not concatenation. But most solutions therefor are flaky even if they exist.

Ferris, in Programming HTML in Rust may have annoyed some gods.

Wow. Looks like my browser renders imgur nonfunctional at this point. Weird.

Zeth0s, (edited ) in Programming HTML in Rust may have annoyed some gods.

I have seen frontends written in c#. Nothing surprises me anymore

etler,

After experiencing struts everything else looks great in comparison

ILikeBoobies, in Programming HTML in Rust may have annoyed some gods.

All programming was intended to take place within Rust

PoolloverNathan, in Very useful filtering

It might be a required parameter.

docAvid, in If only there was a better way

Ever see things like: if ((x == 0) == true)? Or: x = y == ‘z’ ? true : false? Some things just really make me worry about people, you know?

VaxHacker,

I did once see if (!x) strcpy(x, “”);It was from a VB “programmer” who was experimenting with C. In production code.

stOneskull, in I feel threatened the further I scroll

my head exploded before the end

sukhmel, in I feel threatened the further I scroll

This page would have made a good eye chart for measuring eye acuity 🤔

It would require a pretty lengthy scroll to print it on, though

nous, in donno2048/pygoto: Use goto in Python

Or a better idea: don’t use goto. In any language. Especially not one that needs line numbers to work and not labels, as soon as someone edits the file utter chaos will ensue. This has all the normal downsides of gotos with labels, but with far more downsides.

mcmodknower,

It also only works for the main module and only until you hit the recursion limit.

nous, in When your language doesn't allow arbitrary expressions in format strings

You can give it variables:

<pre style="background-color:#ffffff;">
<span style="font-weight:bold;color:#a71d5d;">let</span><span style="color:#323232;"> foo </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">4</span><span style="color:#323232;">;
</span><span style="font-weight:bold;color:#a71d5d;">let</span><span style="color:#323232;"> bar </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#183691;">"bar"</span><span style="color:#323232;">;
</span><span style="color:#323232;">format!(</span><span style="color:#183691;">"</span><span style="color:#0086b3;">{foo}{bar}</span><span style="color:#183691;">"</span><span style="color:#323232;">);
</span>

If you have a format string that long with arbatary expressions putting them all raw in the format string is not going to improve much. Better to give them actual names first.

Walnut356,
@Walnut356@programming.dev avatar

in this case it’s about 80% function calls. They’re convenience functions for assembly instructions, so they’re of the form:

<pre style="background-color:#ffffff;">
<span style="color:#323232;">load(Reg::D, "A"),
</span><span style="color:#323232;">load_const(5),
</span>

which is more useful than variables would be. I guess i could use .join or a crate like concat_string? Either way i sorely miss arbitrary expression format strings from python =(

sukhmel,

As far as I remember, the point for not allowing arbitrary expressions is that it makes what looks like formatting an arbitrary complex operation and that it doesn’t improve readability that much.

Although sometimes I miss being able to refer to fields in format, for function calls and especially this many, I agree with an advice to put strings in a vector and joining them. Plus, there is a limit to how many arguments format macro can accept, iirc

Walnut356,
@Walnut356@programming.dev avatar

it makes what looks like formatting an arbitrary complex operation and that it doesn’t improve readability that much.

What’s silly to me about that reasoning is that all workarounds are equally less convenient, have less readability, and the effect is identical to just letting me put whatever between the brackets. I genuinely dont understand the downside i guess.

Calling .join on a vector can have side effects too, except the “we’re concatting strings” is at the end rather than the beginning (and could obfuscate the fact that the end result is a string). It has just as much room for abuse as a long format!(). Even with just format!(), anything you could do inbetween the brackets, you can do outside the brackets in the arguments anyway. At least when it’s between the brackets, i know exactly where it’s going and when without having to juggle the string pieces and assemble them in my head.

sukhmel,

Well, that’s all true from an end user perspective. But consider that format! is a macro and as such it should process its format string. Calling something from inside evaluation of a format string really does seem weird in that regard

coloredgrayscale,

Creating an array of the function calls, and joining those seems more readable in that case.

Plus you don’t have to take care that you use the correct number of placeholders.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • programming_horror@programming.dev
  • ngwrru68w68
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • anitta
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • provamag3
  • tester
  • Leos
  • megavids
  • JUstTest
  • All magazines