so-dang-cool / dt

dt - duct tape for your unix pipes
https://dt.plumbing/
BSD 3-Clause "New" or "Revised" License
430 stars 12 forks source link

strange bug #64

Open electricWah opened 1 year ago

electricWah commented 1 year ago

Reproduction: [1 2] dup first .s Expected output: [ [ 1 2 ] 2 ] Actual output: [ [ 2 -0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037206620809969885 ] 1 ]

I'm not sure whats causing the weird float in the output, but whats happening is obviously some kind of "copy by reference" bug, especially because [1 2] dup rev rev first .sworks as expected.

While on the subject, may I suggest adding a pop_from_other_side command (aka the opposite of enq), as that is what I was trying to do here but it probably should be a builtin.

booniepepper commented 1 year ago

I don't even know what could have changed to produce this, but I have witnessed something similar. I don't know how to consistently replicate it. looking into this.

As a note, my expected output would be different:

Input: [1 2] dup first .s Expected output: [ [ 1 2 ] 1 ]

Can you also share what platform this is on? (OS and Architecture)


P.S. Feel free to add command ideas into #61 but do know that I plan to be extremely conservative with builtins and the standard library.

booniepepper commented 1 year ago

Even stranger: I cannot replicate this on Linux, but I get similar output on a Mac