#The same code producing different outcome in different projects.

1 messages · Page 1 of 1 (latest)

zealous sleet
#

I am getting different behaviour for uri.parse in two different projects.
uri is in the standard library, both projects rely on version 0.60.0
It's on the same machine so I am getting the same version of gleam

I've recorded the video to show me copy pasting literally the same code.

flat breach
#

target

cinder spindle
#

You're running it on two different targets

#

Still sounds like a bug in the JS implementation

flat breach
#

why many word when few word do

zealous sleet
#

Ah I didn't even think I had erlang installed.

zealous sleet
cinder spindle
#

No idea! 😁
I'm saying the Erlang one is correct because it's the OTP implementation and I'm sure they're in the right

zealous sleet
#

chatGPT agrees.

flat breach
#

oh well thats that settled then

cinder spindle
#

uri.parse used to behave differently on both target for as long as I remember: on the Erlang target we use the OTP implementation (fast and well tested), while on the JS target we hand rolled our own implementation

#

In the long run our JS implementation should behave the same as the Erlang one but it's going to be a big chunk of work

flat breach
#

why cant we use URL global?

cinder spindle
#

I don't know, but I remember there was a reason we didn't use that

crude wolf
#

it doesn't follow the standard either the same way erlang does

flat breach
#

of course it doesnt

crude wolf
#

for {} the standard seems to have forgotten about those characters?? so erlang rejects it and javascript silently percent-encodes them

real coral
#

They're explicitly listed as unsafe

crude wolf
#

doesn't even appear though

real coral
#

Oh yeah I was looking at the older RFC

#

The newer has dropped them

zealous sleet
#

Thanks for the help with the "not so" standards.

snow sierra
#

that's wild

median oyster
#

So what does the latest spec say you’re supposed to do with them?

flat breach
#

they should be percent-encoded

#

A percent-encoding mechanism is used to represent a data octet in a component when that octet's corresponding character is outside the allowed set
the allowed set being:

ALPHA / DIGIT / "-" / "." / "_" / "~"
median oyster
#

Boo Erlang

snow sierra
median oyster
#

Boo, using Jiffy as the Erlang example

real coral
#

Devs attempting to write a spec that's only implemented in one way challenge (impossible)