havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.4, 2.5.6, 2.7.0-preview1: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
ogres has joined #ruby
hutch1 has quit [Ping timeout: 246 seconds]
dviola has joined #ruby
elphe has joined #ruby
hutch1 has joined #ruby
ur5us has quit [Ping timeout: 268 seconds]
elphe has quit [Ping timeout: 245 seconds]
thexa4 has joined #ruby
wildtrees has quit [Quit: Leaving]
dasher00 has quit [Ping timeout: 245 seconds]
smurfendrek123 has quit [Remote host closed the connection]
smurfendrek123 has joined #ruby
jinie_ has joined #ruby
jinie has quit [Ping timeout: 265 seconds]
jinie_ is now known as jinie
chalkmonster has joined #ruby
hutch1 has quit [Ping timeout: 245 seconds]
chalkmonster has quit [Quit: WeeChat 2.6]
fig-le-deunch has quit [Ping timeout: 268 seconds]
thexa4 has quit [Quit: My computer has gone to sleep. ZZZzzz…]
<Iambchop> xco: so you want all except the first column?
<xco> Iambchop: thanks :) past this already
fig-le-deunch has joined #ruby
blackmesa has quit [Quit: WeeChat 2.6]
queip has quit [Ping timeout: 245 seconds]
queip has joined #ruby
Mrgoose84 has joined #ruby
tsrtiv^ has joined #ruby
bambanx has quit [Quit: Leaving]
Mrgoose845 has joined #ruby
beanie__ has joined #ruby
hutch1 has joined #ruby
Mrgoose84 has quit [Ping timeout: 276 seconds]
Mrgoose845 has quit [Read error: Connection reset by peer]
Mrgoose845 has joined #ruby
i9zO5AP has quit [Quit: WeeChat 2.5]
dbugger has quit [Quit: Leaving]
smurfendrek123 has quit [Ping timeout: 245 seconds]
smurfendrek123 has joined #ruby
elphe has joined #ruby
elphe has quit [Ping timeout: 265 seconds]
greengriminal has joined #ruby
dr_mdma_md has quit [Quit: Connection closed for inactivity]
x86sk has quit [Quit: Connection closed for inactivity]
etupat has quit [Remote host closed the connection]
etupat has joined #ruby
etupat has quit [Remote host closed the connection]
etupat has joined #ruby
Azure has quit [Ping timeout: 268 seconds]
Azure has joined #ruby
<banisterfiend> hi
<Swyper> hi
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Swyper> how do you init a blank array
<Swyper> hi havenwood how are you
hutch1 has quit [Ping timeout: 276 seconds]
dasher00 has joined #ruby
<Swyper> Players = [] ?
salinasc has joined #ruby
tdy has joined #ruby
elphe has joined #ruby
tdy4 has quit [Ping timeout: 240 seconds]
<Swyper> while !(valid_play?(@current_player.guess) && dictionary.subset(fragment.to_set)) <-- so fragment is a string in tis case
<Swyper> and .to_set is not defined, so how would I see if a string is a subset of a set?
<Swyper> *and .to_set is not defined for string, I mean
Technodrome has joined #ruby
chalkmonster has joined #ruby
elphe has quit [Ping timeout: 276 seconds]
x86sk has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
tdy1 has joined #ruby
<Swyper> phaul: you there?
salinasc has quit [Remote host closed the connection]
etupat has quit [Remote host closed the connection]
tdy has quit [Ping timeout: 245 seconds]
<leftylink> although String#to_set does not exist, note that Enumerable#to_set does exist (according to https://ruby-doc.org/stdlib-2.6.4/libdoc/set/rdoc/Enumerable.html )
smurfendrek123_ has joined #ruby
<leftylink> therefore, convert a string to the enumerable, where the enumerable contains the units of the string that should be checked for subset-ness.
smurfendrek123 has quit [Ping timeout: 245 seconds]
<leftylink> sorry, I mixed up "a" and "the". let me try again
<leftylink> therefore, convert the string to an enumerable, where the enumerable contains the units of the string that should be checked for subset-ness.
<leftylink> wishing luck!
elphe has joined #ruby
<Swyper> leftylink: game.rb:30:in `play_round': undefined method `subset' for #<Set:0x00007ff9ff03bf28> (NoMethodError)
<Swyper> while !(valid_play?(@current_player.guess) && dictionary.subset(fragment.split().to_set)) <-- updated logic
<Swyper> very strange
<leftylink> indeed, as you can clearly see in https://ruby-doc.org/stdlib-2.6.4/libdoc/set/rdoc/Set.html , there is no such method `subset` for Set.
<leftylink> as the error message has so kindly told you
<Swyper> ahh I forgot the question mark xD
<Swyper> thanks leftylink
dasher00 has quit [Ping timeout: 245 seconds]
<Swyper> @players = @players[(@players.index(@current_player))+1]
elphe has quit [Ping timeout: 240 seconds]
<Swyper> game.rb:46:in `nextplayer!': undefined method `index' for #<Player:0x00007fce5d9aafa0 @name="Sharan"> (NoMethodError)
<Swyper> so players is an array for players, I was trying to call the array method index in this case
<Swyper> I guess I am doing it wrong any idea how I should be doing it right?
<leftylink> > so players is an array
<leftylink> print out the type of @players after time that line is run
<leftylink> and see why that statement is false.
<leftylink> and indeed, you know it must be false. If it were an array, surely `index` would be defined, since we know that Array#index exists
<leftylink> therefore by process of elimination, it is obvious that @players cannot be an array
<leftylink> &ri Array#index
<Swyper> sorry leftylink I am a new coder trying to learn
<leftylink> you don't need to apologise
<leftylink> one of the purposes of the channel is to help people learn
<leftylink> which is what we are trying to do here, right?
<Swyper> yeah for sure
<leftylink> great
<Swyper> game.rb:56:in `<main>': uninitialized constant Players
<Swyper> type(Game.players) <-- this causes that error
<Swyper> I instantiated the game object before this line using Game = Game.new(player_list)
<Swyper> not sure why I can't access the instance variable
<Swyper> should I post the whole code leftylink?
<leftylink> posting the whole code is not conducive to receiving accurate help. posting an MCVE is more conducive
<leftylink> ?mcve
<ruby[bot]> Please provide a Minimal, Complete, and Verifiable example: https://stackoverflow.com/help/mcve
<leftylink> it sure appears that game.rb doesn't know what a Players is, doesn't it? It seems that it should be made aware of that, using the appropriate means.
elphe has joined #ruby
elphe has quit [Ping timeout: 245 seconds]
<Swyper> fair
<Swyper> game.rb:59:in `<main>': undefined method `type' for main:Object (NoMethodError) <-- when I do type(game.players)
<Swyper> so it seems to be saying players is an object ?
<leftylink> it has not said anything about players.
<leftylink> it has said that type is not defined, and that main is an Object
<leftylink> &>> werfasdfasdfads(5)
<rubydoc> stderr: -e:2:in `<main>': undefined method `werfasdfasdfads' for main:Object (NoMethodError)... check link for more (https://carc.in/#/r/7nqg)
<leftylink> just like if we had done that
<Swyper> any ideas how I can find out the type of what players is?
smurfendrek123_ has quit [Ping timeout: 276 seconds]
<Swyper> p Object.class(game.players) <-- tried this got an error game.rb:59:in `class': wrong number of arguments (given 1, expected 0) (ArgumentError)
fig-le-deunch has quit [Read error: Connection reset by peer]
ogres has quit [Quit: Connection closed for inactivity]
fig-le-deunch has joined #ruby
<leftylink> what an interesting error message. as we can see, `class` must take 0 arguments. And what will happen when calling it with 0 arguments?
s2013 has joined #ruby
<leftylink> since it said (given 1, expected 0)
<leftylink> expected 0 tells us that it must take 0
<Swyper> p game.players.class actually gives us "array" as the datatype, thats interesting
greengriminal has quit [Quit: This computer has gone to sleep]
<leftylink> great, so it starts out as an array
<leftylink> and then as we see by the error message posted at 2:08, at some point it becomes something other than an array
<leftylink> so the next step is to figure out when it becomes something that is not an array.
<Swyper> yeah I see, so I put the .class right before where the error is occuring and at that point it becomes an instance of the player class
<Swyper> very strange.. it would make sense if it were an index out of bounds error
<leftylink> great, so something must have changed it to a player instead of an array. so now it is to look at all places where players gets changed
<leftylink> and see which of those places changed it from an array to a player.
s2013 has quit [Quit: Textual IRC Client: www.textualapp.com]
tdy1 is now known as tdy
hutch1 has joined #ruby
Swyper has quit [Remote host closed the connection]
s2013 has joined #ruby
salinasc has joined #ruby
queip has quit [Ping timeout: 240 seconds]
tsujp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tsujp has joined #ruby
dviola has quit [Quit: WeeChat 2.6]
queip has joined #ruby
ur5us has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
fig-le-deunch has quit [Quit: Konversation terminated!]
sigaomatheus has quit [Quit: Leaving]
_whitelogger has joined #ruby
ur5us has quit []
elphe has joined #ruby
elphe has quit [Ping timeout: 240 seconds]
hutch1 has quit [Ping timeout: 246 seconds]
gix has quit [Ping timeout: 245 seconds]
mre- has joined #ruby
salinasc has quit [Remote host closed the connection]
salinasc has joined #ruby
tobiasvl has quit [Ping timeout: 276 seconds]
mre- has quit [Ping timeout: 240 seconds]
dasher00 has joined #ruby
AJA4350 has quit [Remote host closed the connection]
Swyper has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.6]
Swyper has quit [Ping timeout: 265 seconds]
salinasc has quit [Remote host closed the connection]
salinasc has joined #ruby
beanie__ has quit [Ping timeout: 240 seconds]
elphe has joined #ruby
cd has quit [Quit: cd]
dasher00 has quit [Ping timeout: 276 seconds]
brool has quit [Ping timeout: 246 seconds]
xco has quit [Quit: xco]
elphe has quit [Ping timeout: 240 seconds]
elphe has joined #ruby
xco has joined #ruby
elphe has quit [Ping timeout: 240 seconds]
elphe has joined #ruby
CrazyEddy has quit [Ping timeout: 245 seconds]
_whitelogger has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
mre- has joined #ruby
<xco> Can someone help?
<xco> I need regex that will match “ (Sometest”
<xco> sorry
<xco> “ (Sometest)”
<xco> that’ s is space + bracket ….
<xco> :)
elphe has quit [Ping timeout: 240 seconds]
CrazyEddy has joined #ruby
mre- has quit [Ping timeout: 265 seconds]
<leftylink> am confused! aren't regular string operations enough? maybe I shouldn't ask :(
<leftylink> &>> "argh (some)".include?(" (")
<rubydoc> # => true (https://carc.in/#/r/7nr4)
<leftylink> basically it never semeed necessary to use a regex there
<leftylink> maybe I shouldn't ask. the customer knows best, the customer is the boss, etc. etc. etc.
<leftylink> if they want a regex, maybe I should trust that they really do need a regex
<xco> no no i’m not doing Ruby :P
<xco> thought the Rubyists who know regex would help :)
<leftylink> let me check whether &>> lets me grep
<leftylink> &>> `echo argh | grep argh`
<rubydoc> # => "" (https://carc.in/#/r/7nr5)
<leftylink> guess not
<leftylink> okay too bad, guess all I can say is
<leftylink> it looks like the advice I have given is independent of Ruby as well
segy has quit [Ping timeout: 276 seconds]
<leftylink> wishing luck!
<xco> thanks :)
elphe has joined #ruby
segy has joined #ruby
SuperL4g has joined #ruby
elphe has quit [Ping timeout: 268 seconds]
SuperLag has quit [Ping timeout: 245 seconds]
elphe has joined #ruby
freedom has quit [Ping timeout: 268 seconds]
FastJack has joined #ruby
dellavg has joined #ruby
tdy1 has joined #ruby
<SashaZakharchuk> Hi. Active Storage in rails 6 already working well?
etupat has joined #ruby
segy has quit [Ping timeout: 245 seconds]
elphe has quit [Ping timeout: 265 seconds]
s2013 has joined #ruby
tdy has quit [Ping timeout: 245 seconds]
segy has joined #ruby
Emmanuel_Chanel has quit [Read error: No route to host]
etupat has quit [Ping timeout: 268 seconds]
x86sk has quit [Quit: Connection closed for inactivity]
Emmanuel_Chanel has joined #ruby
elphe has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
raul782 has joined #ruby
duderonomy has joined #ruby
hiroaki has joined #ruby
suukim has joined #ruby
DaniG2k has joined #ruby
<DaniG2k> hello all, I'm trying to stub a method in Minitest (from ActionDispatch::IntegrationTest) but having some trouble
<DaniG2k> I basically want to just return an OpenStruct when a controller method is called
<DaniG2k> the OpenStruct makes use of a param (i.e. params[:amount])
<DaniG2k> I haven't been able to find a way to stub methods in MiniTest while preserving the params
<DaniG2k> the struct would be something like OpenStruct.new({amount: params[:amount].to_i * 100})
tdy1 has quit [Ping timeout: 240 seconds]
Mrgoose845 has quit [Ping timeout: 268 seconds]
mre- has joined #ruby
queip has quit [Ping timeout: 276 seconds]
x86sk has joined #ruby
queip has joined #ruby
mre- has quit [Ping timeout: 240 seconds]
elphe has quit [Ping timeout: 245 seconds]
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DaniG2k has quit [Quit: leaving]
salinasc has quit [Remote host closed the connection]
salinasc has joined #ruby
DTZUZO has quit [Ping timeout: 265 seconds]
salinasc has quit [Remote host closed the connection]
salinasc has joined #ruby
mre- has joined #ruby
salinasc has quit [Remote host closed the connection]
mre- has quit [Ping timeout: 240 seconds]
mre- has joined #ruby
mre- has quit [Ping timeout: 245 seconds]
freedom_ has joined #ruby
dellavg has quit [Ping timeout: 265 seconds]
thexa4 has joined #ruby
raul782 has quit [Remote host closed the connection]
raul782 has joined #ruby
hightower2 has quit [Ping timeout: 240 seconds]
dionysus69 has joined #ruby
raul782 has quit [Ping timeout: 245 seconds]
queip has quit [Ping timeout: 240 seconds]
apg has joined #ruby
queip has joined #ruby
elphe has joined #ruby
Yxhuvud has joined #ruby
elphe has quit [Ping timeout: 268 seconds]
schne1der has joined #ruby
DTZUZO has joined #ruby
queip has quit [Ping timeout: 268 seconds]
queip has joined #ruby
Ai9zO5AP has joined #ruby
etupat has joined #ruby
freedom_ has quit [Quit: freedom_]
queip has quit [Ping timeout: 245 seconds]
queip has joined #ruby
etupat has quit [Remote host closed the connection]
etupat has joined #ruby
r3m has quit [Quit: WeeChat 2.7-dev]
r3m has joined #ruby
Fernando-Basso has joined #ruby
r3m has quit [Client Quit]
r3m has joined #ruby
etupat has quit [Ping timeout: 265 seconds]
queip has quit [Ping timeout: 265 seconds]
elphe has joined #ruby
queip has joined #ruby
chalkmonster has joined #ruby
thexa4 has quit [Quit: My computer has gone to sleep. ZZZzzz…]
chunkypuffs has quit [Quit: ZNC 1.7.1 - https://znc.in]
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
chunkypuffs has joined #ruby
dasher00 has joined #ruby
dionysus69 has quit [Ping timeout: 245 seconds]
apg has quit [Ping timeout: 245 seconds]
nowhereman has quit [Ping timeout: 276 seconds]
thexa4 has joined #ruby
Fraeon has quit [Remote host closed the connection]
thexa4 has quit [Client Quit]
queip has quit [Ping timeout: 240 seconds]
queip has joined #ruby
gix has joined #ruby
endorama has joined #ruby
blackmesa has joined #ruby
Swyper has joined #ruby
Swyper has quit [Ping timeout: 245 seconds]
rapha has left #ruby ["WeeChat 2.3"]
rbanffy has joined #ruby
schne1der has quit [Ping timeout: 276 seconds]
schne1der has joined #ruby
Inline__ has joined #ruby
Inline__ has quit [Remote host closed the connection]
Inline has quit [Ping timeout: 264 seconds]
schne1der has quit [Ping timeout: 245 seconds]
Intelo has joined #ruby
thexa4 has joined #ruby
Inline has joined #ruby
thexa4 has quit [Client Quit]
bitwinery has quit [Quit: Leaving]
rippa has joined #ruby
queip has quit [Ping timeout: 265 seconds]
queip has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.6]
hightower2 has joined #ruby
Flyingdog has joined #ruby
D9 has quit [Ping timeout: 265 seconds]
ali has joined #ruby
ali is now known as arlmath
ali has joined #ruby
elphe has quit [Ping timeout: 240 seconds]
AJA4350 has joined #ruby
schne1der has joined #ruby
elphe has joined #ruby
queip has quit [Ping timeout: 240 seconds]
queip has joined #ruby
Ven`` has joined #ruby
ellcs has joined #ruby
salinasc has joined #ruby
fphilipe has quit [Ping timeout: 265 seconds]
Inline has quit [Quit: Leaving]
etupat has joined #ruby
ellcs has quit [Ping timeout: 245 seconds]
Swyper has joined #ruby
<Swyper> hi leftylink sorry I fell asleep yesterday
etupat has quit [Ping timeout: 240 seconds]
etupat has joined #ruby
<Swyper> hi havenwood are you around
<Swyper> still cant figure out why my players array gets converted into a player
<Swyper> @players = @players[(@players.index(@current_player))+1] I think it is because of this line
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven`` has joined #ruby
Ven`` has quit [Client Quit]
<phaul> Hi Swyper, can you point us to the (latest) code?
Swyper has quit [Remote host closed the connection]
Esa_ has joined #ruby
<phaul> oh well...
chihhsin has joined #ruby
fphilipe has joined #ruby
Inline has joined #ruby
mre- has joined #ruby
lucasb has joined #ruby
salinasc has quit [Remote host closed the connection]
mre- has quit [Ping timeout: 265 seconds]
etupat has quit [Ping timeout: 268 seconds]
Swyper has joined #ruby
<Swyper> hey phaul, do you want me to upload both classes on github?
<phaul> hi Swyper yeah, seeing the code would help
<Swyper> game.rb is where the error is occuring
<Swyper> so I define and check that players is an array before hand
<Swyper> and it stays an array until the call of next_round! probably @ the line I linked to
<Swyper> what I was trying to do was simply have it switch to the next element
hiroaki_ has joined #ruby
<phaul> do you mean nextplayer! I can't see nextround!
<Swyper> yeah sorry nextplayer!
<Swyper> @players = @players[(@players.index(@current_player))+1] this line is what is messing it up im pretty sure
<phaul> I agree with you. So why do you make an assingment that changes the value of @players ?
<phaul> why not change @current_player, that should be something that changes
dionysus69 has joined #ruby
hiroaki_ has quit [Client Quit]
<Swyper> @current_player = @players[(@players.index(@current_player))+1]
<phaul> the array of all players should be kept as it's always the same (unless new players join the game or players depart)
<Swyper> Traceback (most recent call last):
<Swyper> game.rb:30:in `play_round': undefined method `guess' for nil:NilClass (NoMethodError)
<Swyper> 1: from game.rb:60:in `<main>'
<phaul> yes, that looks good, except what happens if it was the last player
cnsvc_ has joined #ruby
<phaul> you are trying to get a player that comes after this one in the array, but that doesn't work at the end of the array
<Swyper> index out of bounds xD
cnsvc has quit [Remote host closed the connection]
<phaul> no, just nil
<Swyper> o
<phaul> &>> [1,2,3][13]
<rubydoc> # => nil (https://carc.in/#/r/7nvt)
<phaul> which matches the no method error later that you are seeing
<Swyper> I want it to restart @ the starting of the array when it gets to the end
<phaul> are you familiar with modulo arithmetics?
jacki has joined #ruby
iNs_ has joined #ruby
<Swyper> yeah
<phaul> ok, just calculate indices modulo array length
<Swyper> alright
<Swyper> thanks phaul
<phaul> yw
iNs has quit [Remote host closed the connection]
fphilipe has quit [Ping timeout: 276 seconds]
FastJack has quit [Ping timeout: 264 seconds]
Swyper has quit [Remote host closed the connection]
conta1 has joined #ruby
hiroaki has quit [Ping timeout: 265 seconds]
jacki has quit [Remote host closed the connection]
xco has quit [Quit: xco]
nowhereman has joined #ruby
FastJack has joined #ruby
Intelo has quit [Ping timeout: 245 seconds]
hiroaki has joined #ruby
blackmesa has quit [Ping timeout: 276 seconds]
fphilipe has joined #ruby
jacksoow has quit [Ping timeout: 250 seconds]
jacksoow has joined #ruby
HyperTables has joined #ruby
jacksoow has quit [Ping timeout: 245 seconds]
jacksoow has joined #ruby
queip has quit [Ping timeout: 265 seconds]
queip has joined #ruby
kegster has left #ruby [#ruby]
dasher00 has quit [Read error: Connection reset by peer]
poontangmessiah has joined #ruby
fphilipe has quit [Ping timeout: 276 seconds]
<havenwood> Swy, I'm around now
s2013 has joined #ruby
<havenwood> g'mornin'
<phaul> morning, havenwood
<havenwood> phaul: halloo
<phaul> how are things?
Swyper has joined #ruby
dasher00 has joined #ruby
suukim has quit [Quit: Konversation terminated!]
queip has quit [Ping timeout: 265 seconds]
hiroaki has quit [Ping timeout: 265 seconds]
suukim has joined #ruby
lightstalker has quit [Remote host closed the connection]
<havenwood> Sprained my foot jumping out of a tree, so I can't walk. Otherwise, good!
suukim has quit [Client Quit]
suukim has joined #ruby
<phaul> ouch, that sounds painful
dionysus70 has joined #ruby
dionysus69 has quit [Ping timeout: 240 seconds]
dionysus70 is now known as dionysus69
<havenwood> no pain unless i try to bear weight, at least - can code Ruby!
<phaul> good way of thinking
<Swyper> thats always a plus (being able to code ruby) :P
<havenwood> Swyper: indeed
<Swyper> weird how I fix one bug and so many more pop up
<Swyper> game.rb:30:in `play_round': undefined method `guess' for nil:NilClass (NoMethodError)
queip has joined #ruby
<havenwood> nil.guess
<Swyper> what does .guess do?
kyrylo has joined #ruby
<phaul> Swyper: did you do the modulo aritmetics logic on the indices?
<havenwood> Swyper: Might `@current_planner` be `nil`?
<Swyper> I did this instead phaul if @players[players.length] == @current_player
<phaul> you are missing the @ sign on players + arrays go from 0 to length - 1
<phaul> so @players[@players.length] is again after the last element
<al2o3-cr> the good old ~-a.size
<Swyper> ah I see
<Swyper> if @players[players.length-1] == @current_player
<Swyper> @current_player = @players[0]
<Swyper> changed it to this so hopefully that issue is fixed
<Swyper> but I am still getting @current_player to be nil and I can't figure out why
<phaul> you are still missing the @ sign
lightstalker has joined #ruby
hiroaki has joined #ruby
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<phaul> im not even sure how this worked, is it also an attr_reader? probably... in that case it doesn't matter
<Swyper> yeah tis also an attr_reader
<Swyper> *its
<al2o3-cr> i don't think i've ever seen an instance variable in the metasplot framework.
<al2o3-cr> everything is attr'd and self used.
<al2o3-cr> in the core of te framework that is
<Swyper> o-o
<Swyper> *has no idea what this conversation is about*
<phaul> SandiM is a big advocate of that style. But I don't like polluting my external interfaces. ofc you could make those private
<al2o3-cr> Swyper: don't go down that path
<phaul> I just don't see the point. It feels yagni to me. I will do it when I need it
<Swyper> al2o3-cr: sorry I'm new to ruby I don't exactly understand what you said xD
<al2o3-cr> phaul: it's not as though the creator of the metasploit framework is naive
<phaul> Swyper: there is a style in which you make everything - every single instance variable an attr_access
<Swyper> oh
<phaul> or
<Swyper> I've never even worked in a framework yet my course will be teaching me rails though
<Swyper> I also use rails at work by that I mean I am an incompetent intern who knows abit of ruby syntax xD
<al2o3-cr> Swyper: it's used to be written in perl then rewritten in ruby
<havenwood> phaul: I prefer explicit instance variables in Ruby too. Being faster and explicit signals to the reader about simplicity are two wins I like.
<Swyper> interesting
<havenwood> phaul: I don't like mucking up the public interface at all.
<Swyper> still trying to figure out why @current_player is nil
etupat has joined #ruby
hutch1 has joined #ruby
fphilipe has joined #ruby
<Swyper> with the magic of print statements I figured out the error is happening on this line: @current_player = @players[(@players.index(@current_player))+1]
<phaul> Swyper: post the updated full code again. We don't want to second guess what else is there
<Swyper> kk
grilix has joined #ruby
<Swyper> updated phaul
<havenwood> Swyper: It's traditional to drop the parens and .rb from #require_relative: https://github.com/RickArora/ruby_part_two/blob/master/W1D1/Ghost/game.rb#L3
<havenwood> Swyper: Be sure your tabs are set to "two-space soft tabs" since they look funny: https://github.com/RickArora/ruby_part_two/blob/master/W1D1/Ghost/game.rb#L5
lightstalker has quit [Remote host closed the connection]
<havenwood> ?spaces
<ruby[bot]> havenwood: I don't know anything about spaces
<havenwood> ?tabs
<ruby[bot]> Ruby community standards recommend using 2 spaces as indentation (see https://github.com/bbatsov/ruby-style-guide#spaces-indentation and https://ukupat.github.io/tabs-or-spaces/).
<phaul> the bug is that Player#== doesn't work as you expect it
<Swyper> so require_relative'player'
<havenwood> Swyper: Yes: require_relative 'player'
<phaul> wait a minute. ignore what I said for a moment
<havenwood> Swyper: Seems you're equivocating between `@fragment` and `fragment`, which is weird on lines like this one: https://github.com/RickArora/ruby_part_two/blob/master/W1D1/Ghost/game.rb#L17
queip has quit [Ping timeout: 240 seconds]
<havenwood> Swyper: On that time ^ line, just use: @fragment += character
<Swyper> yeah that stems mostly from me being a noob with instance variables and throwing an @ on the start of instance variables randomly
<havenwood> Swyper: Then on the next line, @dictionary.
<Swyper> if I have a attr_accessor in place when do I need to use the @ to reference instance variables?
<havenwood> Swyper: When you're returning true if any, consider #any? over #each.
<havenwood> Swyper: There's often an alternative to #each.
<daed> havenwood: like #map?
<havenwood> Swyper: Avoid empty parens in Ruby, so `split` not `split()`.
<havenwood> daed: Yeah, I find I seldom use #each in practice but *very* often use #map and friends.
<daed> same here
lightstalker has joined #ruby
<Swyper> fair
<Swyper> changed my tabs to be 2 spaces
<havenwood> Swyper: \o/
<daed> 2 spaces 4 life
<al2o3-cr> 3 no?
<al2o3-cr> how about 1
<al2o3-cr> super cool
<daed> i wrote my own terminal so that i could do 0.5 fractional tab spaces
<Swyper> lol
<al2o3-cr> Swyper: what type of game you making?
<Swyper> just a replica of Ghost for App Academy
<al2o3-cr> oh, nice ;)
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Swyper> its a top bootcamp that released their course online for free so I am using it to learn Ruby & React
<Swyper> aaonline.io
<al2o3-cr> Swyper: and do you think you've learnt anything from it?
<Swyper> yeah I'd say I've learnt a fair bit of Ruby syntax and some good practices
<al2o3-cr> ok, fair play.
<Swyper> I'm not making as much progress as I would like cause I am a full time CS student and have a full time internship aswell xD
<al2o3-cr> awesome, hope you pass!
<Swyper> thank you :)
cd has joined #ruby
<phaul> ah. i was com[pletely on the wrong track but see the rror now
<phaul> I ignored the chat, what's the current status? Is the cause still needed?
<Swyper> yeah cause is still needed :p
<Swyper> @current_player = @players[(@players.index(@current_player))+1] I feel like its this but I can't pinpoint why phaul
xco has joined #ruby
<phaul> it's quite obscure
banisterfiend has joined #ruby
<phaul> in method nextplayer! you do an if.. elsif ... end
<phaul> notice the elsif part.
<phaul> that should have been just an else
<phaul> as an additional bug you also assign @current_player with the result of the method in play_round
<phaul> the result of the method is nil because it takes a branch that has no body
<phaul> that is the elsif part as the assignment is taken as the condition
xco has quit [Ping timeout: 240 seconds]
poontangmessiah has quit [Remote host closed the connection]
<al2o3-cr> Swyper: e.g.
fphilipe has quit [Ping timeout: 276 seconds]
<al2o3-cr> &>> if false then :foo else :bar end
<rubydoc> # => :bar (https://carc.in/#/r/7nwp)
<al2o3-cr> &>> if false then :foo elsif :bar then end
<rubydoc> # => nil (https://carc.in/#/r/7nwq)
blackmesa has joined #ruby
xco has joined #ruby
<Swyper> ;o
<Swyper> i see
Fernando-Basso has quit [Remote host closed the connection]
etupat has quit [Remote host closed the connection]
Ven`` has joined #ruby
etupat has joined #ruby
<HyperTables> the docs for read_nonblock are confusing. is the nonblock flag set for the read call only or on the file descriptor, potentially affecting other threads?
nowhereman has quit [Ping timeout: 246 seconds]
etupat has quit [Ping timeout: 240 seconds]
blackmesa has quit [Ping timeout: 264 seconds]
deathwishdave has joined #ruby
greengriminal has joined #ruby
<phaul> does it work now as you expect?
<Swyper> nope :P
etupat has joined #ruby
<phaul> :(
deathwishdave has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Swyper> so like when the fragement = "look" it should recognize that and say player.name + "wins"
<Swyper> the word "look" is most def in the dictionary
etupat has quit [Remote host closed the connection]
etupat has joined #ruby
<al2o3-cr> HyperTables: the file descriptor
<Swyper> huh ?
<Swyper> o
xco_ has joined #ruby
etupat has quit [Remote host closed the connection]
etupat has joined #ruby
xco has quit [Ping timeout: 265 seconds]
xco_ is now known as xco
chalkmonster has joined #ruby
suukim has quit [Quit: Konversation terminated!]
hutch1 has quit [Ping timeout: 246 seconds]
beanie__ has joined #ruby
greengriminal has quit [Ping timeout: 240 seconds]
jmcgnh has quit [Ping timeout: 240 seconds]
greengriminal has joined #ruby
Intelo has joined #ruby
hutch1 has joined #ruby
jmcgnh has joined #ruby
xco has quit [Quit: xco]
ogres has joined #ruby
brool has joined #ruby
deathwishdave has joined #ruby
Esa_ has quit []
nowhere_man has joined #ruby
<Swyper> phaul: now it works, I was calling subset the wrong way xD
<phaul> yay!
hutch1 has quit [Ping timeout: 250 seconds]
<al2o3-cr> Swyper: "👍"
<al2o3-cr> &>> "👍".bytes
<rubydoc> stderr: -e:2: invalid multibyte char (US-ASCII)... check link for more (https://carc.in/#/r/7nx9)
<al2o3-cr> &>> "👍".force_encoding('binary')
<rubydoc> stderr: -e:2: invalid multibyte char (US-ASCII)... check link for more (https://carc.in/#/r/7nxa)
<al2o3-cr> &>> "👍".force_encoding('utf8').bytes
<rubydoc> stderr: -e:2: invalid multibyte char (US-ASCII)... check link for more (https://carc.in/#/r/7nxb)
<al2o3-cr> oh shit
<leftylink> interesting.
cnsvc_ has quit [Remote host closed the connection]
cnsvc_ has joined #ruby
<al2o3-cr> i really need to find a decent font.
Intelo has quit [Read error: Connection reset by peer]
Intelo has joined #ruby
deathwishdave has quit [Read error: Connection reset by peer]
kabads has quit [Read error: Connection reset by peer]
<phaul> I tried to get this working with &url but even that doesn't work.
<phaul> dies when the bot tries to serialize the request to json to send to carc.in...
<al2o3-cr> &>> Encoding.default_external = 'utf-8'; "👍".bytes
<rubydoc> stderr: -e:2: invalid multibyte char (US-ASCII)... check link for more (https://carc.in/#/r/7nxj)
<al2o3-cr> &>> Encoding.default_external = 'utf-8'; "👍".force_encoding('utf8').bytes
<rubydoc> stderr: -e:2: invalid multibyte char (US-ASCII)... check link for more (https://carc.in/#/r/7nxk)
<al2o3-cr> wtf
x86sk has quit [Quit: Connection closed for inactivity]
ellcs has joined #ruby
<al2o3-cr> &>> 0xff.chr
<rubydoc> # => "\xFF" (https://carc.in/#/r/7nxl)
<al2o3-cr> &>> 10042.chr('utf-8')
<rubydoc> # => "\u273A" (https://carc.in/#/r/7nxm)
cnsvc_ has quit [Remote host closed the connection]
<al2o3-cr> &>> Encoding.default_external('utf-8'); 10042.chr('utf-8')
<rubydoc> stderr: -e:2:in `default_external': wrong number of arguments (given 1, expected 0) (ArgumentError)... check link for more (https://carc.in/#/r/7nxn)
<al2o3-cr> &>> Encoding.default_external = 'utf-8'; 10042.chr('utf-8')
<rubydoc> # => "✺" (https://carc.in/#/r/7nxo)
henninb has joined #ruby
cnsvc_ has joined #ruby
<al2o3-cr> &>> Enconding.default_encoding
<rubydoc> stderr: -e:2:in `<main>': uninitialized constant Enconding (NameError)... check link for more (https://carc.in/#/r/7nxr)
<al2o3-cr> &>> Encoding.default_encoding
<rubydoc> stderr: -e:2:in `<main>': undefined method `default_encoding' for Encoding:Class (NoMethodError)... check link for more (https://carc.in/#/r/7nxt)
<al2o3-cr> &>> Encoding.default_external
<rubydoc> # => #<Encoding:US-ASCII> (https://carc.in/#/r/7nxu)
<al2o3-cr> &>> Encoding.default_internal
<rubydoc> # => nil (https://carc.in/#/r/7nxv)
<al2o3-cr> ah
<al2o3-cr> phaul: you'd need default_external set when sending the request
<al2o3-cr> well present
brool has quit [Ping timeout: 250 seconds]
<phaul> what do I set it to? Is it safe to set it for all the time? Like can I just set it once on boot up?
<al2o3-cr> sure, you're chaning binary/ascii to utf-8
<al2o3-cr> phaul: or ask jhass to set encoding to utf-8 in the sandbox.
etupat has quit [Remote host closed the connection]
kabads has joined #ruby
etupat has joined #ruby
<al2o3-cr> or you could just for now do; Encoding.default_external = 'utf-8'; p begin ...
<al2o3-cr> phaul: can you try that?
ellcs has quit [Quit: Leaving.]
<phaul> sure. but Im slightly confused by these things sorry. my utf-8 knowledge is virtually nonexistent
<phaul> not virtually. literarly. whatever :)
etupat has quit [Ping timeout: 268 seconds]
<al2o3-cr> phaul: that error will stop then.
rubydoc has quit [Remote host closed the connection]
rubydoc has joined #ruby
<phaul> &>> 1
<rubydoc> # => 1 (https://carc.in/#/r/7nxz)
<phaul> like that? ^
<al2o3-cr> &>> 10042.chr('utf-8')
<rubydoc> # => "✺" (https://carc.in/#/r/7ny0)
<al2o3-cr> yay :)
<al2o3-cr> nice one phaul, it was doing my head in :P
<phaul> url way is still broken then
<phaul> also we have &bare , &ast, &tok, &asm
<al2o3-cr> i know :)
<phaul> my question is - is this the right way to go about this?
<al2o3-cr> for now, sure.
<phaul> ok. but we all know what "for now" mean in software. :)
<al2o3-cr> basically carc.in sandbox is ascii
<al2o3-cr> phaul: it's sandboxed ;P
<al2o3-cr> what shouldn't get through won't.
<al2o3-cr> get executed by the interpreter i mean
<phaul> no Im' not worried about that. Im trying to understand what the correct solution is to this problem
<al2o3-cr> phaul: ask jhass to change to encoding to utf-8
<al2o3-cr> why he didn't set it up as utf-8 in the first place idk
<al2o3-cr> it just needs a change in locale
<al2o3-cr> &>> 1337.chr('utf-8')
<rubydoc> # => "Թ" (https://carc.in/#/r/7ny1)
wald0 has joined #ruby
<phaul> I'm still confused about the url exception that happened here https://github.com/phaul/yarr/blob/master/lib/yarr/evaluator_service.rb#L49
MrCrackPot has joined #ruby
wald0 has quit [Read error: Connection reset by peer]
<al2o3-cr> phaul: carc.in is using ascii-8bit instead of utf-8. it's merely an encoding problem
<al2o3-cr> phaul: e.g
<al2o3-cr> &>> 1337.chr('utf-8')
<rubydoc> # => "Թ" (https://carc.in/#/r/7ny3)
<phaul> but the url command dies before it was even sent out
<al2o3-cr> that is utf-8 encoding
<al2o3-cr> &>> 1337.chr('utf-8').force_encoding('binary')
<rubydoc> # => "\xD4\xB9" (https://carc.in/#/r/7ny4)
fphilipe has joined #ruby
etupat has joined #ruby
wald0 has joined #ruby
<phaul> so it didn't reach carc in, so it can't be anything to do with that. It died as it serialized the string for carc in (that it fetched from the gist)
<al2o3-cr> phaul: what's your enconing?
<al2o3-cr> *encoding
<al2o3-cr> phaul: what's your enconing?
<phaul> what's the easiest way to tell
<al2o3-cr> *encoding
wald0 has quit [Client Quit]
<al2o3-cr> type 'locale' in shell
<phaul> LANG=en_US.UTF-8
<al2o3-cr> seems legit
<al2o3-cr> phaul: can you show me /srv/yarr/yarr/lib/yarr/evaluator_service.rb
chalkmonster has quit [Quit: WeeChat 2.6]
elphe has quit [Quit: leaving]
jinie has quit [Quit: ZNC 1.6.1 - http://znc.in]
jinie has joined #ruby
<phaul> let me make sure that lines match up with the backtrace.. I repost the logs with a new request. I did do a git pull in between
elphe has joined #ruby
krl has joined #ruby
<al2o3-cr> phaul: don't worry about it, it's in the cinch handler.
hutch1 has joined #ruby
<phaul> phew. One less thing to worry about ;) thanks al2o3-cr
<al2o3-cr> np phaul 8)
<al2o3-cr> phaul: when you get time, you can ask jhass if he would modify the encoding though
hutch1 has quit [Ping timeout: 276 seconds]
<phaul> correct me if I'm wrong, but then Typhoeus must have given me a ascii encoded string here with https://github.com/phaul/yarr/blob/master/lib/yarr/command/url_evaluate.rb#L30 invalid bytes
<phaul> isn't the web service, in this case gist.github.com responsible for sending the correct encoding in the response headers?
Esa_ has joined #ruby
Esa_ has quit [Client Quit]
Esa_ has joined #ruby
<phaul> yeah. I stopped there with pry. So github sends charset=utf-8 but after receiving it from Typhoeus user_content.body.encoding is #<Encoding:ASCII-8BIT>
fphilipe has quit [Ping timeout: 276 seconds]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
grilix has quit [Ping timeout: 268 seconds]
<phaul> ppl don't seem to be that bothered about it, it was reported 2 years ago
hightower2 has quit [Ping timeout: 245 seconds]
<leftylink> lol
<al2o3-cr> phaul: i never knew that typhoeus returns the body as ascii, and never checked tbh. but, that still doesn't change the fact the carc.in is still using ascii encoding
<phaul> sure. that's the issue you had with &>>. the typhoeus issue is what we have with &url
<al2o3-cr> phaul: in that case, force_encode the body to utf-8
<phaul> ah. I feel it's a Typhoeus bug. Nobody uses &url anyways :)
<phaul> just wanted to understand what's happening..
hiroaki has quit [Remote host closed the connection]
hiroaki has joined #ruby
<al2o3-cr> phaul: just for completeness, adjust it anyway.
<phaul> right, but I need more complex logic aren't I given the gist service can be any url with any encoding in the headers. What if the response header truly contains us-ascii? Or a force utf-8 work for every encoding?
<al2o3-cr> what am i going on about, the body is always going to be binary. derp.
dinfuehr has quit [Ping timeout: 265 seconds]
<al2o3-cr> with any http client
AJA4351 has joined #ruby
hiroaki has quit [Ping timeout: 245 seconds]
dinfuehr has joined #ruby
nowhere_man has quit [Ping timeout: 276 seconds]
<al2o3-cr> phaul: are you not encoding the url or something?
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
<al2o3-cr> phaul: are you using CGI.escape?
<phaul> no. I don't see how the url encoding is any way related. open pry. do require 'typhoeus'; x = Typhoeus.get('https://gist.githubusercontent.com/phaul/560f9af2b37d00133c6a475fb22a0e3f/raw/87271f2f7a4151acd756249138827cd1ae1618a2/encoding.rb'); x.response_body.encoding
<phaul> x.headers["Content-Type"] says "text/plain; charset=utf-8". is this a proof of the bug?
ellcs has joined #ruby
fphilipe has joined #ruby
troulouliou_dev has joined #ruby
<phaul> then if you require 'json' and do x.body.to_json then it blows up with the exact error message from the backtraces
<al2o3-cr> try it.
hutch1 has joined #ruby
booboy has quit [Quit: ZNC - https://znc.in]
KeyJoo has joined #ruby
<phaul> but it also gives .response_code == 0 which is not good
Intelo has quit [Remote host closed the connection]
<phaul> it didn't even go out to github because it escaped the url parts like /s and : in http://
booboy has joined #ruby
chalkmonster has joined #ruby
cow[moo] has joined #ruby
<al2o3-cr> phaul: is this on &url only?
<phaul> yeah, that's the only way to fetch code from external sources
Intelo has joined #ruby
<al2o3-cr> sorry, what's the error again?
<phaul> the error is that the fetched code can contain utf-8 chars and the encoding on it set to ascii. When it's then sent to carc.in, the to_json on it dies. https://gist.github.com/phaul/4ef57de12c7ff2a8642072f56b1480d0#file-err-txt-L2881
<al2o3-cr> thanks, taking a look now
troulouliou_dev has quit [Quit: Leaving]
mre- has joined #ruby
raul782 has joined #ruby
<al2o3-cr> phaul: i'm not even sure where the byte 240 is coming from
bambanx has joined #ruby
<phaul> that's the first bit of your thumbs up. look at the gist under the url
<al2o3-cr> i can't see that, my font is funky :P
<al2o3-cr> thats blank in the browser
<al2o3-cr> i understand now
henninb has quit [Quit: Lost terminal]
<phaul> yeah, not seeing what's there makes things really confusing
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
<al2o3-cr> &>> Encoding::Converter.new('binary', 'utf-8').then { |e| e.convert("\xf0") }
<rubydoc> stderr: -e:4:in `convert': "\xF0" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)... check link for more (https://carc.in/#/r/7ny6)
thexa4 has joined #ruby
<al2o3-cr> &url foo
<rubydoc> Request returned response code 0
<al2o3-cr> &url google.com
<rubydoc> Request returned response code 301
<al2o3-cr> &url https://example.com
<rubydoc> stderr: -e:1: syntax error, unexpected '<'... check link for more (https://carc.in/#/r/7ny7)
<al2o3-cr> &url example.com
<rubydoc> stderr: -e:1: syntax error, unexpected '<'... check link for more (https://carc.in/#/r/7ny8)
mre- has quit [Quit: Lost terminal]
<al2o3-cr> phaul: can your bot be queried?
fphilipe has quit [Ping timeout: 245 seconds]
<phaul> what query do you want?
akemacer has quit [Quit: Leaving]
cyclonis has joined #ruby
<al2o3-cr> phaul: thumbs up is encoded in cp866
Intelo has quit [Remote host closed the connection]
Intelo has joined #ruby
<al2o3-cr> anyway, cinch catches all errors
<al2o3-cr> i'm at a loss with this
<al2o3-cr> i just can't see it
<phaul> thanks al2o3-cr for taking the time anyways. we just leave it, maybe I raise a github issue that tracks the fact that we can't handle utf-8 from remote gist services with all our findings.
<phaul> we can have github issues that nobody looks at for years too! XD
conta1 has quit [Quit: conta1]
<al2o3-cr> it's definitely not github
cyclonis has quit [Read error: Connection reset by peer]
<phaul> no. you did see my this I said: 193318 phaul | https://github.com/typhoeus/typhoeus/issues/580
<phaul> I mean - did you see when I said this^
cyclonis has joined #ruby
<al2o3-cr> yep, that not a github issue
<phaul> issue on github, that's what I meant
etupat has quit [Remote host closed the connection]
<al2o3-cr> phaul: sorry, yes, i know what you mean now.
<phaul> unrelated: next week probably I'm arriving back in Ye good old Bligthy
<al2o3-cr> cool, where've you been?
<phaul> spent a year in Hungary
<al2o3-cr> family over there or just sailing, seeing the world?
<phaul> family over here. I can't sail as I don't have the funds. Probably I will become a weekend sailor. Sailing all the time eats up a lot of funds
<al2o3-cr> i watch steve callahan adrift, f**k me, that is my worst nightmare!!
blackmesa has joined #ruby
<phaul> I agree, I think about the possibility of falling out, and Im single handed. And the boat drives itself. It *will* leave me there. It's frightening
<al2o3-cr> no shit
<al2o3-cr> i'm not scared of water, but thousands of miles of any shore, well, i'll be ...
<phaul> well furthest I ever been with my boat was the scillies :)
<al2o3-cr> hope you got a nice pizza ;)
<havenwood> rescues cost a ton, but nicer than being adrift
<al2o3-cr> it's the fear of the unknown
<al2o3-cr> well, to me anyway. i'd just give up.
etupat has joined #ruby
<havenwood> I love the freezing in 2.7 but I'm curious what all will break with Symbol/TrueClass/FalseClass/NilClass all returning a frozen String.
<havenwood> It'd be interesting to write a little scanner to compile instruction sequences and detect the offending gems.
<havenwood> I recently tried implementing binary bytecode caching for RubyGems and was surprised home many gems actually had an error with producing binary code intermediary representation with RubyVM::InstructionSequence.
<havenwood> how many**
<phaul> it's this one https://bugs.ruby-lang.org/issues/16150 right?
akemacer has joined #ruby
<havenwood> phaul: that's related, but not merged.
<havenwood> Module#name too
<phaul> havenwood: nice. I also like these changes
ellcs has quit [Ping timeout: 245 seconds]
<havenwood> phaul: Now that binary code is 1/4 of the size in 2.7 (love that work!) I'm interested in compiling gem binary code from parsing the source and caching that alongside the gem code locally with RubyGems.
<havenwood> phaul: Then the trick is figuring out how to load the binary automagically with RubyGems on require if the checksum checks out.
<havenwood> I've been trying to integrate with RubyGems, but here's a spike showing just trying to generate parallel yarb files for each gems source: https://gist.github.com/havenwood/414367192cf22f66d01a3117064713e7
<phaul> that's an interesting project. I need so much to lern on these internals. When you say binary do you mean the jit c compiled into an object?
<phaul> learn*
<havenwood> (Which, I guess not surprisingly, caused errors with multiple gems I have installed.
<havenwood> )
<havenwood> phaul: Pre-JIT, the grammar parsing phase before the VM.
krl has quit [Quit: Connection closed for inactivity]
<havenwood> phaul: Ruby VM takes about a third of the time on parsing the grammar into IR binary with a typical Ruby file.
<havenwood> phaul: Then the JIT only applies to compiling that VM binary into machine bytecode just in time.
<phaul> IR being?
<havenwood> phaul: intermediary representation that YARV uses
akemacer has quit [Quit: Leaving]
dionysus69 has quit [Quit: dionysus69]
<phaul> is that what we get with RubyVM::IntructionSequence?
<havenwood> phaul: yes
<phaul> got it
dionysus69 has joined #ruby
<havenwood> Elixir, for example, compiles to IR aggressively.
<al2o3-cr> havenwood: nice idea.
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
<havenwood> al2o3-cr: I think it's ko1's plan, at least he's given us the tools to do it and the recent binary shrink makes it only more appealing.
<havenwood> yomikomu, that bootsnap is based off of, shows some ideas: https://github.com/ko1/yomikomu
<havenwood> but we should be able to get the speed wins of bootsnap outside of rails, and do it at install time for gems
<al2o3-cr> i've seen.
<havenwood> yomikomu shows every which way
<havenwood> i think we should pick one that works well with gems, and wire it up
<havenwood> it's a bit hard to figure out how to make it work with #require
<havenwood> i figured out a way with shims, but haven't benchmarked it and am skeptical
<havenwood> benchmarking just loading the bytecode is very promsing
ellcs has joined #ruby
<al2o3-cr> forget shims imho
<havenwood> it's about the same speed for 1-liners and multiple times faster for 1000-liners.
jud has quit [Read error: Connection reset by peer]
<havenwood> al2o3-cr: yeah, it's fugly and repetitive
<havenwood> al2o3-cr: it just lets you use traditional requiring so it's a complete cheat
<al2o3-cr> exactly.
<havenwood> al2o3-cr: i got a spike working that hijacks require, like rubygems does, but it only loads the entrypoint - which is sad
<al2o3-cr> we need something more subordinate
<havenwood> it loads gem/lib/gem.rb, but needs to *just work*
<havenwood> if someone wants to work on it, I'd love to contribute a working version to RubyGems
<havenwood> it's a half step toward working generally with Ruby tooling
<havenwood> lower hanging fruit, no doubt
<havenwood> working with just Rails was the lowest
etupat has quit [Remote host closed the connection]
etupat has joined #ruby
<havenwood> i'm curious what all gems fail with just compiling to IR... i had about 6 locally installed ones fail running that ^ script.
<al2o3-cr> that's where it goes to the unknown
<havenwood> i think it should fallback to working regularly with any error or if gem code is changed in a file
<havenwood> free wins, no errors
<havenwood> worst case, works like before
etupat has quit [Remote host closed the connection]
etupat has joined #ruby
<havenwood> funny that #to_binary takes an argument for "extra" data and then #load_from_binary_extra_data gets that back
<havenwood> you can just append to a binary to add your own extra
<phaul> I can't see how valid code cannot be compiled into IR.. Or in other words how code that cannot can be valid
<havenwood> phaul: do your gems work with that ^ script? :)
<al2o3-cr> havenwood: it's not compatible with all platforms.
<havenwood> phaul: I thought I'd hit some dead code paths, but more than I expected blew up.
<havenwood> al2o3-cr: which part?
ellcs has quit [Ping timeout: 265 seconds]
<al2o3-cr> #load_from_binary
<al2o3-cr> not your code.
<havenwood> ahh, gotcha
<havenwood> al2o3-cr: what doesn't it work with?
<al2o3-cr> well, from my machine to yours.
<havenwood> al2o3-cr: ah, yeah - I mean to compile the binaries for gems at install time
<havenwood> al2o3-cr: this ^ script just simulates as though you've done that
<al2o3-cr> oh, right. i get what your saying now 8)
<havenwood> al2o3-cr: (creates a parallel /binaries folder with parallel content for all .rb files in /gems)
<al2o3-cr> yep, i see
<al2o3-cr> havenwood: what you think about numbered params
<havenwood> binary = Zlib::GzipReader.open(binary_path, encoding: Encoding::BINARY, &:read) && RubyVM::InstructionSequence.load_from_binary(binary).eval
<havenwood> al2o3-cr: I think they show Elixir envy, which makes sense to me. ;)
<havenwood> al2o3-cr: I appreciate eregon's argument that _0, _1 as it was would cause type issues and mass confusion.
<al2o3-cr> havenwood: just don't like them one bit.
<havenwood> al2o3-cr: I'm glad that _1 is now `{ |x| x }` rather than `{ |x,| x }`, which is fun but unintuitively destructuring.
<al2o3-cr> is it me being personal, idk. just no!
<al2o3-cr> yeah, i understand that, but, just shouldn't be.
<al2o3-cr> imho
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<havenwood> al2o3-cr: i feel the same way i do about the syntax in Elixir, which is that i use it when it's not confusing only
dionysus69 has quit [Ping timeout: 245 seconds]
<havenwood> i admit it's a bit less noise
<al2o3-cr> Elixir is a functional language, it makes sense.
<havenwood> Ruby is a lispy, object oriented, functional language.
<havenwood> al2o3-cr: I look forward to more immutable data structures.
<al2o3-cr> not really functional
wald0 has joined #ruby
<al2o3-cr> me too.
<havenwood> al2o3-cr: It's more functional than most.
etupat has quit [Remote host closed the connection]
<havenwood> al2o3-cr: Everyone has first class functions these days, so I don't think that counts for much. I wish Ruby had fancier currying, especially for kwargs.
<al2o3-cr> ruby used to be simple and to the point. i feel not any more.
wald0 has quit [Read error: Connection reset by peer]
<havenwood> But it has currying! You can do lambda calculus. #map, #filter, #filter_map. Ruby is way more friendly towards programming functionally than many.
etupat has joined #ruby
etupat has quit [Remote host closed the connection]
etupat has joined #ruby
<havenwood> al2o3-cr: I think Elixir or Clojure are more simple and to the point, but <3 Ruby.
<havenwood> It has a different elegance and simplicity.
<al2o3-cr> why spoil a good language?
<havenwood> al2o3-cr: I don't think Ruby is getting spoiled at all. It was always an incredibly complex grammar focused on experienced C programmers that beginners could somehow grok.
wald0 has joined #ruby
<al2o3-cr> havenwood: it is. simple expressions are turning into ugly ones.
<havenwood> al2o3-cr: I think Matz has done an amazing job at pushing back against things that would compromise Ruby while keeping it relevant.
<havenwood> al2o3-cr: like what?
<havenwood> al2o3-cr: also, experimental features are experiments and more these days are yanked than ever before
<al2o3-cr> @1 _1 just no!
<al2o3-cr> hell, no!
<havenwood> al2o3-cr: Not everything is positional, and I'm not a fan of positional generally, but when it is positional, doesn't bother me.
<al2o3-cr> not at all, but meh
<havenwood> al2o3-cr: I'm more excited about RBS type signatures in Ruby with type-profiler as a level one type profiler giving us feedback without any annotations.
<havenwood> al2o3-cr: Those should both be part of Ruby 3 and *just work*. I love being able to write the Ruby I love and still keep up with performance and correctness guarantees.
<al2o3-cr> havenwood: some effort put in to this. i think this is incredible work!
dviola has joined #ruby
<havenwood> al2o3-cr: I think the functional dabbling will end up being great for Ruby. Guilds should bring it home.
<havenwood> al2o3-cr: I'm kinda meh for anything positional.
<havenwood> al2o3-cr: keywords sure are nicer for currying!
wald0 has quit [Read error: Connection reset by peer]
<havenwood> entangling by name is better than by position
wald0 has joined #ruby
<al2o3-cr> havenwood: he should of just got rid of the GIL/GVL
wald0 has quit [Read error: Connection reset by peer]
<havenwood> al2o3-cr: guilds do that
<al2o3-cr> in a context though
<havenwood> al2o3-cr: if the lock isn't interpreter/VM side, it's not a GVL/GIL
<havenwood> al2o3-cr: there's a branch of Ruby without a GVL, and it works great for multiple cores, but it's slow for single threaded
<al2o3-cr> why?
<havenwood> al2o3-cr: fine grained locks are expensive
<al2o3-cr> i'm on a single core
<havenwood> i mean that just adding a ton of fine grained locks to CRuby significantly impairs single core performance
<havenwood> that's one way to remove the GVL, and it isn't pretty for single core performance
<havenwood> Guilds keep single core performance while letting you peg all cores.
dviola has quit [Quit: WeeChat 2.6]
<al2o3-cr> seriously?
<havenwood> Objects can be members of the Guild, in which case they can be mutated by Threads in the Guild.
wald0 has joined #ruby
<havenwood> al2o3-cr: Which part for seriously? :P
<al2o3-cr> Guilds keep single core performance while letting you peg all cores.
greengriminal has quit [Quit: This computer has gone to sleep]
wald0 has quit [Client Quit]
<havenwood> al2o3-cr: Yeah, they don't introduce fine grained locks that slow single core Ruby but they allow Threads in different Guilds to peg different cores.
dviola has joined #ruby
rbanffy has quit [Quit: rbanffy]
<al2o3-cr> proof?
<havenwood> al2o3-cr: Channels let you copy or move Objects between Guilds. If you move it, the Guild membership changes.
<havenwood> al2o3-cr: You can just share an immutable Object between Guilds.
<al2o3-cr> havenwood: what about mutable objects?
<havenwood> al2o3-cr: You can dup em or xfer ownership via a Channel.
<havenwood> al2o3-cr: Mutable objects can only be the member of one guild at a time, but you can duplicate them across Guilds.
<havenwood> Or transfer Guild membership to another Guild.
<al2o3-cr> right, that sounds promising
<al2o3-cr> havenwood: like fibers?
<havenwood> al2o3-cr: Fibers and the new Selector should be the solution for parallel IO.
<havenwood> al2o3-cr: Guilds are the solution for parallel processing.
dviola has quit [Quit: WeeChat 2.6]
<al2o3-cr> havenwood: will threads be deprecated?
diego1 has joined #ruby
<havenwood> al2o3-cr: No, not in Ruby 3.
diego1 has quit [Client Quit]
<al2o3-cr> i mean the thread class?
<havenwood> al2o3-cr: Guilds will have Threads which have Fibers.
dviola has joined #ruby
<havenwood> al2o3-cr: ioquatix has been working a ton on async fibers
<havenwood> al2o3-cr: this is the selector: https://github.com/ruby/ruby/pull/1870
sdfds has joined #ruby
dviola has quit [Client Quit]
etupat has quit [Remote host closed the connection]
<al2o3-cr> so let me get this right. giuld are a medium for threads to run in parallel, switching between fibers?
<havenwood> "A Guild has at least one Thread and a Thread has at least one Fiber."
dviola has joined #ruby
<havenwood> al2o3-cr: Not quite, since Threads don't switch between Fibers to be able to run in parallel.
<havenwood> al2o3-cr: Two Guilds can schedule parallel Threads.
<al2o3-cr> i think i get it
<havenwood> al2o3-cr: Many Fibers can do async I/O.
<al2o3-cr> of course
sdfds has quit [Remote host closed the connection]
<havenwood> al2o3-cr: Fibers are cool since they can suspend while they're waiting for I/O, and they have a tiny stack.
<havenwood> al2o3-cr: Guilds are the other end of things, letting Threads work on parallel cores while simplifying sharing memory.
<al2o3-cr> havenwood: yeah, that's how Async works.
sdfds has joined #ruby
<havenwood> al2o3-cr: Exactly, Async Fibers are for I/O and Guilded Threads are for processing.
<al2o3-cr> havenwood: i'll be 37 when ruby 3 comes about 8)
tdy1 has joined #ruby
<havenwood> ->{ }.isolate.call # isolated proc
<havenwood> Ruby is changing. And surviving!
etupat has joined #ruby
sdfds has quit [Client Quit]
<al2o3-cr> ruby will survive an apocalypse.
<havenwood> It seems Matz bit off just the right amount.
<al2o3-cr> i'll tell you what, ror is what made it
<havenwood> al2o3-cr: Rails 6 is super nice too. I love what they're doing.
<havenwood> al2o3-cr: Ruby keeps Rails alive and vice versa.
<havenwood> Shark and... parasite?
<havenwood> ;P
<al2o3-cr> 8)
<havenwood> I guess Rails isn't a suckerfish.
greengriminal has joined #ruby
<al2o3-cr> ruby is best interpreted language on the planet. FACT!
* havenwood chants Compile Rails!
<al2o3-cr> without a shadow of a doubt.
<al2o3-cr> programming is easy
<al2o3-cr> a baby can do it
<havenwood> everything but programming is easy, except for babies
<havenwood> (programming is hard.)
fphilipe has joined #ruby
<havenwood> al2o3-cr: fun, but hard
<al2o3-cr> easy, but fun :)
<havenwood> simple made easy
<havenwood> our brains are bad at these things. we're better at fabricating.
<al2o3-cr> simply made easy! 8)
<al2o3-cr> the ruby language, C side, is far from simple.
<al2o3-cr> to many macros
Ven`` has joined #ruby
<al2o3-cr> havenwood: i've had a computer head since 1987 lol
<havenwood> al2o3-cr: I don't know what year for me, but probably the same.
AJA4350 has quit [Ping timeout: 268 seconds]
<havenwood> al2o3-cr: This was the second I had access to, through my dad: http://oldcomputers.net/kaypro2000.html
<havenwood> I think 84 was when I first used a computer, age 5.
<havenwood> No Ruby.
<al2o3-cr> havenwood: never had one, but, what i did have; commodore 64/128, psion series 3a, amiga 600/1200, bbc microcomputer from the 70's from school, acorn micro and even a apple micro 2
<havenwood> al2o3-cr: Ah, the one before the Kapro 2000 was a Kapro II. I guess my dad was a Kapro fan.
<havenwood> So I was 3 when he got it.
<havenwood> I remember that one too. The 5 1/4 drives.
<al2o3-cr> yeah, 5 and quarter floppies lol
<havenwood> they were truly floppy
<al2o3-cr> bit before my time them havenwood
<havenwood> yes, I'm old
<al2o3-cr> nah, in ya prime lol ;)
<al2o3-cr> i remember going to the local library, old unix systems. Wwow, wouldn't get them again
<al2o3-cr> i can't even remember what terminals they were
ellcs has joined #ruby
cyclonis has quit [Read error: Connection reset by peer]
postmodern has joined #ruby
bitwinery has joined #ruby
elphe has quit [Ping timeout: 240 seconds]
i9zO5AP has joined #ruby
Ai9zO5AP has quit [Ping timeout: 265 seconds]
<al2o3-cr> it's weird americans still use the imperial measurements, but when it comes to fishing in UK uses imperial measurements.
brool has joined #ruby
salinasc has joined #ruby
<al2o3-cr> little hybrid from the other week
thejs has joined #ruby
fphilipe has quit [Ping timeout: 276 seconds]
i9zO5AP is now known as Ai9zO5AP
aloy has quit [Ping timeout: 268 seconds]
aloy has joined #ruby
Ai9zO5AP has quit [Quit: WeeChat 2.5]
Ai9zO5AP has joined #ruby
weird_error has joined #ruby
cyclonis_ has joined #ruby
greengriminal has quit [Quit: This computer has gone to sleep]
etupat has quit [Remote host closed the connection]
tdy1 has quit [Ping timeout: 245 seconds]
xco has joined #ruby
jmcgnh_ has joined #ruby
jmcgnh has quit [Ping timeout: 265 seconds]
<al2o3-cr> &>> [23013].pack('U')
<rubydoc> # => "姥" (https://carc.in/#/r/7nzg)
jmcgnh_ is now known as jmcgnh
jmcgnh is now known as jmcgnh_
jmcgnh_ is now known as jmcgnh
nowhere_man has joined #ruby
etupat has joined #ruby
elphe has joined #ruby
KeyJoo has quit [Quit: KeyJoo]
i9zO5AP has joined #ruby
ellcs has quit [Ping timeout: 264 seconds]
Ai9zO5AP has quit [Ping timeout: 240 seconds]
elphe has quit [Ping timeout: 268 seconds]
cyclonis_ has quit [Read error: Connection reset by peer]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lucasb has quit [Quit: Connection closed for inactivity]
drincruz_ has quit [Ping timeout: 265 seconds]
CrazyEddy has quit [Ping timeout: 265 seconds]
Intelo has quit [Ping timeout: 265 seconds]
cyclonis has joined #ruby
Swyper has quit [Remote host closed the connection]
AJA4350 has joined #ruby
sdfds has joined #ruby
john__ has joined #ruby
sdfds has quit [Remote host closed the connection]
john__ has quit [Remote host closed the connection]
Intelo has joined #ruby
john__ has joined #ruby
schne1der has quit [Ping timeout: 265 seconds]
thexa4 has quit [Quit: My computer has gone to sleep. ZZZzzz…]
weird_error has quit [Quit: weird_error]
<john__> hi
galaxie has joined #ruby
john__ has quit [Quit: Leaving]
blackmesa has quit [Ping timeout: 245 seconds]
weird_error has joined #ruby
weird_error has quit [Client Quit]
etupat has quit [Remote host closed the connection]
etupat has joined #ruby
Swyper has joined #ruby