<weaksauce>
all your tests are written for a particular version of ruby so it makes sense to hedge your bet that it will be best to run on that particular version of ruby
<weaksauce>
a point release probably doesn't break anything but it's easy enough to do
<plujon>
What do tests have to do with it?
<plujon>
I'm confused. I'm surprised to hear that tests are written "for a particular version of ruby". I nearly always do the opposite: write Ruby code that works in any relatively modern Ruby.
desnudopenguino1 has joined #ruby
<weaksauce>
the wording may be off but i mean you develop on xyz version and that is tested on xyz version so you want to deploy to xyz version
desnudopenguino has quit [Ping timeout: 264 seconds]
desnudopenguino1 is now known as desnudopenguino
<aesthetikx>
its funny watching React start it's downslope
<aesthetikx>
fear. uncertainty. panic sets in. its only a matter of time before isreactdead.com, etc.
<sarna>
Shell: yeah, or when you have a small dedicated team (and they're up for learning a new thing)
<sarna>
Sampersand: lol nice! how much did it take you to make it compile?
<Sampersand>
three attempts over six months lol
<sarna>
:D
<Sampersand>
it still has a ton of rough edges and will segfault on things but it works for basic stuff
<Sampersand>
it's crazy how different it is
<Sampersand>
blocks are `do fncall(...) using var; ... end`
<sarna>
oh dang
<sarna>
glad it's the other way around now tbh
<Sampersand>
also, the exception syntax is `protect; ...; resque; ...; ensure; ... end`
<sarna>
it's the tree-walking interpreter, right?
<sarna>
how much slower are the microbenchmarks?
<Sampersand>
yeah
<Sampersand>
havent checked, but the man file (which i had to translate from EUC-JP and then into google translate ;-p) said that it's a decent amount slower than awk/perl
<sarna>
how the tables have turned, hehe
<Sampersand>
hahahah yeah
<Sampersand>
it's wack, a lot of things i didnt think would be in early ruby (eg `include`) existed, but stuff i coulda sworn would have existed early on (eg `print` defaulting to `$_`) don't
<Sampersand>
it's also fun being able to use `$=`, and have `.123` be actual valid syntax
<Sampersand>
try it out, download it and compile it :-)
<sarna>
I'm on arm, will it work?
<Sampersand>
yep, i compiled it on my m1
<leftylink>
probably makes a good talk at some point, like what were the obstacles to making it work
<Sampersand>
i plan on trying to present at rubyconf
<sarna>
oh cool, let me try then
<Sampersand>
one of my ideas is "ruby 0.47"
<sarna>
ruby 0 x 47 (0 productivity, 47 times slower)
<Sampersand>
lol
<Sampersand>
one of my goals now is to write a decently sized program that works in any ruby version
<Sampersand>
sarna it's almost 2am, so im heading to sleep soon
<Sampersand>
try cloning it and following the instructions for modifying the makefile
<sarna>
it works!
<Sampersand>
OH, also, when you make it, do `CPPFLAGS=-D__R47_BUGFIX make` — I added a flag where it fixes some bugs that are intrinsic to it
<sarna>
tho I'm getting "syntax error" trying to run anything lol
<sarna>
guess it really did change a lot
<Sampersand>
CPPFLAGS is required because CFLAGS is overwritten
<sarna>
ah okay
<Sampersand>
if you know how to read EBNF syntax, i boiled down parse.y into syntax.ebnf
<sarna>
neat, I'll check it out
<Sampersand>
nice, have fun
<Sampersand>
since it compiles, i'll head to bed now ;-p
<sarna>
have a good sleep o/
<Sampersand>
oh, here's an example program
<Sampersand>
```
<Sampersand>
def one_upto(max)
<Sampersand>
for x in 1..max
<Sampersand>
yield x
<Sampersand>
end
<Sampersand>
end
<Sampersand>
do one_upto(10) using i
<Sampersand>
print("in here: ", i, "\n")
<Sampersand>
end```
<sarna>
🙏
<Sampersand>
there's also `sample/` but i havent tested any of them and idk if they actually work
<Sampersand>
anyways, gn :wave:
Sampersand has quit [Quit: Client closed]
<sarna>
gn
Guest1923 has joined #ruby
<leftylink>
dang, I wanted to see if there is any definition you can do to make this do/using thing work (like datDkio1AXM)
<leftylink>
but I kinda doubt it since there's parentheses and then the block argument is just bare
<leftylink>
pandabot: ytid datDkio1AXM
<pandabot>
RubyConf 2018 - Ruby is the Best Javascript by Kevin Kuchta by Confreaks @ 2018-12-11T23:55:13Z (1661d9h ago) 35m8s: https://youtu.be/datDkio1AXM
Guest1923 has quit [Ping timeout: 246 seconds]
<nona>
oh wait, so ruby is not dead afterall, leftylink? :)
<sarna>
ha, I got fibonacci working
<sarna>
fib(35) takes 15 seconds on ruby 0.47, 1s on ruby 3.2
<sarna>
0.2s with yjit :D
<sarna>
funny, the toy language from "crafting interpreters" book takes 2.5s for the same thing (tree walking interpreter written in java)
<sarna>
but it's not a real language (no exceptions, for example) - so..
<sarna>
Bish: if you want an array of binary strings, just ensure they have the "BINARY" encoding
<sarna>
(same as "ASCII-8BIT")
<Bish>
that still won't render me enable to to_json it
<sarna>
pandabot rb [1,2,3,4,5].pack('c*')
<sarna>
well guess I don't know how to use the bot
markong has joined #ruby
<Bish>
yeah what about [1,2,[3],4,5]
<Bish>
because my problem is ["\xff", "\xaa"]
<sarna>
what do you have initially, and what would you want to end up with?
<sarna>
earlier you posted a flat array of strings
<Bish>
yes, that, and i want .to_json it
<sarna>
`[1,2,3,4,5].pack('c*').to_json` works just fine
<Bish>
yeah but it has nothing to do with array of strings
<sarna>
ditto for `[[1,2,3,4,5].pack('c*')].to_json`
<Bish>
well.. okay
<Bish>
you want me to data.map { |x| x.pack("c*")}
<sarna>
I don't know, because you won't tell me what the data is :D is it strings initially? and you want them to be binary? or do you already have something like `["\x01\x02\x03\x04\x05"]`
<sarna>
it'd be better to encode an array of bytes to json, because with strings you need them to be valid utf-8
<sarna>
your initial example (`["\xD6cjC\xD3\x83O\x10\xAA?3a+\x85\xFC\xB4", "\xC3f4c\x00\x00\x
<sarna>
00\x00\x00\x00\x00\x00"].to_json`) fails exactly because these strings are not valid utf-8
<leftylink>
of course, there is base 64
<Bish>
sarna: the data looks like "\xff"
<Bish>
it's strings but.. not really
<Bish>
it's binary data read from redis, yeah not utf8
<Bish>
they're serialized rust structs
roshanavand__ has joined #ruby
<Bish>
> it'd be better to encode an array of bytes to json, because with strings you need them to be valid utf-8
<Bish>
ruby strings are awfully fine with it, i'd wish json wouldbe aswell
roshanavand_ has quit [Ping timeout: 264 seconds]
konsolebox has quit [Read error: Connection reset by peer]
Jojero has quit [Ping timeout: 260 seconds]
<sarna>
ok, so the minimal example that fails is `"\xC3f".to_json`
<sarna>
what works:
<sarna>
`"\xC3f".unpack('C*').to_json` - produces an array of bytes, `"[195,102]"`
<sarna>
`Base64.encode64("\xC3f").to_json` - produces a b64encoded string, `"\"w2Y=\\n\""`
<sarna>
Bish: I don't know any better options.. myself I'd pick the first one
<nona>
leftylink: your recursive fibonacci is on average twice as fast as the non-recursive one i'd found somewhere (use two starting vars, keep adding them together: f=[]; x=100; n1=0; n2=1; x.times{f<<n1 if n2>1;n1,n2=n2,n1+n2}). you said "we know how to write it fast". i definitely don't.
<Bish>
well certainly not as pretty
<Bish>
when i see the .inspect format of ruby i know if somethings wrong
<Bish>
this way i see numbers
<Bish>
i'd be cool to be "human readable"
<sarna>
Bish: ruby strings are fine with it because they can contain broken contents for their encoding. try `"\xC3f".valid_encoding?` - it's invalid utf8, and yet it works
<nona>
Math.inspect => 'Math' ... pretty human readable, no?
<nona>
oh, you're talking about strings
<sarna>
json specifies that all escapes need to produce valid utf-8 graphemes
<sarna>
hex-escaped stuff mixed with ascii characters is more human-readable than byte values?
<sarna>
do you want it to match the rust representation so you can check if something's wrong? or
<sarna>
would a helper method work? when you have something produced by `String#unpack('C*')`, you can get the initial string by doing `[foo.map {|
<sarna>
b| b.to_s(16)}.join].pack('H*')]` (assuming `foo` is your array of bytes)
<sarna>
though at this point I'd reconsider using base64 :D
Semino75 has joined #ruby
sands has joined #ruby
Semino75 has quit [Ping timeout: 240 seconds]
sands has quit [Ping timeout: 245 seconds]
Jojero has joined #ruby
Jojero has quit [Ping timeout: 240 seconds]
konsolebox has joined #ruby
<Bish>
hex-escaped stuff mixed with ascii characters is more human-readable than byte values?
<Bish>
yes, maybe just because i am used to it
<Bish>
> do you want it to match the rust representation so you can check if something's wrong?
<Bish>
no i'd prefer the ruby thingie.. the rust representation would be a neatly struct
Tempesta has quit [Quit: See ya!]
taupiqueur_shiny has joined #ruby
Tempesta has joined #ruby
konsolebox has quit [Ping timeout: 240 seconds]
taupiqueur_shiny has quit [Remote host closed the connection]
hansolo has quit [Read error: Connection reset by peer]
taupiqueur_shiny has joined #ruby
konsolebox has joined #ruby
markong has quit [Ping timeout: 240 seconds]
otisolsen70 has joined #ruby
hansolo has joined #ruby
roshanavand_ has joined #ruby
roshanavand__ has quit [Ping timeout: 245 seconds]
Huckleberry777 has quit [Quit: Huckleberry777]
markong has joined #ruby
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Read error: Connection reset by peer]
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Read error: Connection reset by peer]
Linux_Kerio has joined #ruby
roshanavand_ has quit [Ping timeout: 252 seconds]
keypresser86 has joined #ruby
taupiqueur_shiny has quit [Remote host closed the connection]
taupiqueur_shiny has joined #ruby
taupiqueur_shiny has quit [Ping timeout: 246 seconds]
konsolebox has quit [Ping timeout: 240 seconds]
infinityfye has joined #ruby
_ht has joined #ruby
konsolebox has joined #ruby
Huckleberry777 has joined #ruby
konsolebox has quit [Remote host closed the connection]
konsolebox has joined #ruby
Sankalp has quit [Ping timeout: 240 seconds]
teclator has quit [Ping timeout: 250 seconds]
Fernando-Basso has joined #ruby
Sankalp has joined #ruby
konsolebox has quit [Quit: Leaving]
konsolebox has joined #ruby
TomyWork has joined #ruby
Linux_Kerio has quit [Ping timeout: 252 seconds]
markong has quit [Ping timeout: 250 seconds]
konsolebox has quit [Remote host closed the connection]
diego1 has quit [Quit: WeeChat 4.0.0]
hermit has joined #ruby
hermit has quit [Max SendQ exceeded]
TomyWork has quit [Remote host closed the connection]
caedmon has joined #ruby
caedmon has quit [Ping timeout: 250 seconds]
mexen has joined #ruby
<adam12>
gday
<weaksauce>
hello
<_ht>
Good afternoon!
<_ht>
Just fixed a bug. As usual, some stupid mistake I made months ago :-(
<ox1eef_>
base64-encode, then to_json. But it is hard to consider binary data human readable, maybe you could give it a structure with json otherwise I wouldn't be that concerned how it looks.
<tockitj>
Ruby used to have as many users as #python channel did some years ago. Is there another ruby chan - or is this it?
<ox1eef_>
This is it.
<tockitj>
So unfortunate. Love the lang though.
Sankalp has quit [Ping timeout: 252 seconds]
infinityfye has quit [Quit: Leaving]
<weaksauce>
irc is dying all over the place is why
<weaksauce>
discord is pretty active
Sankalp has joined #ruby
roshanavand has joined #ruby
roshanavand_ has joined #ruby
tomtmym has quit [Quit: Gone.]
roshanavand has quit [Ping timeout: 240 seconds]
_ht has quit [Quit: _ht]
<leftylink>
that is definitely a shame since naturally discord is forbidden at work, whereas we use irc for work so obviously irc is allowed
roadie has quit [Remote host closed the connection]
<leftylink>
obviously I can still use discord during non-working hours, but between working hours and sleep and other non-computer activites well there isn't much time left over now is there
roadie has joined #ruby
<leftylink>
too bad
<ox1eef_>
Discord is a for-profit, centralized platform. Not for me.
roadie has quit [Ping timeout: 255 seconds]
mexen has quit []
<sarna>
leftylink: you're using irc for work? it's pretty insecure, no? but maybe I'm just uneducated
<ox1eef_>
You can lockdown who can connect, who can join channels, it supports encryption, etc. Far more DIY but not insecure by design.
<sarna>
ah neat, I didn't know that. I thought it was "open by design"
<ox1eef_>
It is, but you can add rules on top of it.
<tockitj>
what might be replacement for irc?
<ox1eef_>
I don't think we will see one because we're in the era of big corporations concerned about profit more than anything else.
<tockitj>
that was always the case I think. Capitalism is ancient. At least when compared to comp-sci
<sarna>
supposedly that replacement is matrix, right?
<ox1eef_>
Nah. The internet was born void of that. And then, it became a vehicle for big business.
<tockitj>
oh? but is there a client for it. I just found out about it today (by listing largest channels here)
<sarna>
yeah there's an official client called element
<sarna>
element.io
<ox1eef_>
If things were the same, discord would have a protocol specification, a diversity of clients, etc. A lot of the time, business wants control more than user choice.
<sarna>
it's not pretty, and kinda buggy.. but it works, and it's decentralized, you can self-host it (IIRC), etc
<tockitj>
ox1eef_: but people will always want corporate-free option, right? I mean.. I never considered otherwise.
<sarna>
ox1eef_: yeah meanwhile they ban you for using alternative clients :)
<tockitj>
sarna: sounds sort of like xmpp, may it rest in peace
<ox1eef_>
tockitj: Agreed. I don't think it is new. But it seems more profound than ever.
<tockitj>
element.io seems quite neat. Though it is just a product (no free option as far as I can tell)
<sarna>
"corpos should not own internet." - I think it comes to one issue: people don't want to run their own servers
<sarna>
they just want to click on something and have it work without thinking about it
<tockitj>
sarna: wow - this looks pretty awesome - like free slack. I like this
<sarna>
and the only way you can achieve that is centralizing everything
<ox1eef_>
I think it is mostly to do with most people being oblivious to the reality.
<tockitj>
meh, people are people. all we need is a sound cause and people will rally - some will. this can shift on its head in a little. though profound changes like this would come from the student/teenagers
<tockitj>
that is how facebook/wechat/instagram/and whatnot came about
<ox1eef_>
Well, I mean, if you're a chef you probably don't care. You want something that's easy and solves a problem. Beyond that it's not a concern.
roadie has joined #ruby
roadie has quit [Ping timeout: 255 seconds]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
markong has joined #ruby
roadie has joined #ruby
nmollerup has quit [Quit: Leaving]
roadie has quit [Ping timeout: 255 seconds]
<leftylink>
hmm. there's someone in another channel I'm in who uses matrix and has a lot of positive things to say about it
<leftylink>
I haven't tried it yet. I'm too set in my ways. that's a bad thing. if you stop learning, you stop growing
roadie has joined #ruby
<adam12>
tockitj: Wow, #python does have quite a few users.
<adam12>
I wonder if it makes a difference that it's the _official_ Python IRC channel. AFAIK, nobody has ever explicitely blessed a Ruby IRC channel as official.
<tockitj>
there used to be ruby-lang and ruby on freenode. also matz used to hang around irc too
<weaksauce>
it
<weaksauce>
is official. ruby is dead
<weaksauce>
jk
roadie has quit [Ping timeout: 255 seconds]
<tockitj>
dead or alive, it is still one of the best designed langs I know of :)
<weaksauce>
it still powers some of the biggest websites in the world :)
<tockitj>
look, I am also on R and prolog so.. ¯\_(ツ)_/¯
roadie has joined #ruby
<leftylink>
yeah whether it is dead or alive can have no effect my actions, since the fact remains that I know no scripting language that I would rather use
<leftylink>
this does tie into the previous statements of "if you stop learning you stop growing" though - it wouldn't do to be a dinosaur who refuses to change from Ruby because I'm grumpy about it. It has to be a considered decision
<leftylink>
there are things to be learned here, like "is it because people are trying out other alternatives? what are those alternatives? are they useful for me?"
roadie has quit [Ping timeout: 255 seconds]
<leftylink>
one of the engineers whom I respect the most is really into Perl, but it didn't seem like he was stuck on Perl. he was also very skilled at Ruby
<leftylink>
I just hope that I too can avoid getting stuck