<leftylink>
I don't know if there is any language-design reason why args are eagerly evaluated or if it was just "we had to choose one or the other so we chose eager"
<leftylink>
so all I know right now is that this is the way it is
envex has quit []
<leitz>
I'm mostly an apprentice level coder. Not really skilled enough to say it should be this, or that. Just trying to understand it.
<leitz>
It's good to learn something.
deepreds1 has joined #ruby
jenrzzz has joined #ruby
ged has joined #ruby
jottr has quit [Ping timeout: 244 seconds]
andikr has joined #ruby
<leitz>
Okay, back later. Hopefully I can get some sleep.
jenrzzz has quit [Ping timeout: 258 seconds]
<leftylink>
wow, while trying to figure shit out... it is... not pleasant if to_s does not return a string
<leftylink>
I guess they figured "if anyone does that, they're asking for it"
<leftylink>
yeah so since by definition the language eagerly evaluates, if you want lazy evaluation... uh I guess you can use thunks?
<leftylink>
&24>> def a; print "THANK YOU FOR CALLING a, THE FUNCTION!!!"; 99 end; class Thunk def initialize(&b) @b=b end; def to_s; @b[].to_s end end; print Thunk.new { "a=" }, Thunk.new { a }, Thunk.new { "\n" }
<leftylink>
as the `for i in 1..5; x = 3 if i == 3; puts x if i == 5; end` and `for i in 1..5; puts x if i == 5; x = 3 if i == 3; end` examples showed though, another iteration of the loop doesn't cause the variables to go out of scope. but lexical rules still apply; can't use a variable at a point in the program that comes lexically before its definition
<leftylink>
by the way this happens with `(1..5).each { |i| ... }` as well, which I suppose should not be any more suprising than the above
bitwinery has quit [Quit: Leaving]
<leftylink>
&24>> (1..5).each { |i| x = 3 if i == 3; puts x if i == 5 }
amateur_rubyist has quit [Remote host closed the connection]
rsenic has joined #ruby
rsenic has quit [Client Quit]
rsenic has joined #ruby
involans has joined #ruby
jenrzzz has joined #ruby
gregf_ has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
lalitmee has quit [Remote host closed the connection]
vircung has quit [Quit: Nothing to do here]
gregf_ has quit [Remote host closed the connection]
dbugger has joined #ruby
gigetoo has quit [Ping timeout: 245 seconds]
vircung has joined #ruby
gigetoo has joined #ruby
lalitmee has joined #ruby
lalitmee has quit [Max SendQ exceeded]
thomas_25 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lalitmee has joined #ruby
jenrzzz has joined #ruby
rsenic has quit [Ping timeout: 260 seconds]
Freshnuts has quit [Quit: Leaving]
ur5us_ has joined #ruby
ur5us_ has quit [Read error: Connection reset by peer]
amateur_rubyist has joined #ruby
ur5us_ has joined #ruby
amateur_rubyist has quit [Remote host closed the connection]
queip has quit [Ping timeout: 248 seconds]
amateur_rubyist has joined #ruby
thomas_25 has joined #ruby
thomas_25 has quit [Client Quit]
thomas_25 has joined #ruby
queip has joined #ruby
dbugger has quit [Remote host closed the connection]
dbugger has joined #ruby
ellcs has joined #ruby
jenrzzz has quit [Ping timeout: 248 seconds]
tdy has quit [Ping timeout: 248 seconds]
jottr has joined #ruby
dionysus69 has quit [Read error: Connection reset by peer]
dionysus69 has joined #ruby
Doow has joined #ruby
<Doow>
what's the current status of ruby gems for 2.6 on windows? https://rubyinstaller.org/ claims that support isn't very good yet, but that was in january. They have not posted any updates about it since then from what I can see.
john2496 has joined #ruby
john2496 has quit [Read error: Connection reset by peer]
john2496 has joined #ruby
john2496 has quit [Remote host closed the connection]
tsujp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jottr has joined #ruby
x86sk has quit [Quit: Connection closed for inactivity]
jenrzzz has joined #ruby
tsujp has joined #ruby
thomas_25 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tsujp has quit [Ping timeout: 258 seconds]
schneider has quit [Ping timeout: 245 seconds]
Swyper has quit [Remote host closed the connection]
dionysus69 has quit [Remote host closed the connection]
yasumi2136 has quit [Remote host closed the connection]
Swyper has joined #ruby
thomas_25 has joined #ruby
thomas_25 has quit [Ping timeout: 268 seconds]
drnerdius has joined #ruby
drnerdius has quit [Client Quit]
dionysus69 has joined #ruby
drnerdius has joined #ruby
drnerdius has quit [Read error: Connection reset by peer]
drnerdius has joined #ruby
drnerdius has quit [Client Quit]
tsujp has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
al2o3-cr has quit [Ping timeout: 246 seconds]
esrse has quit [Ping timeout: 248 seconds]
Tuor has quit [Read error: Connection reset by peer]
Tuor has joined #ruby
Tuor has quit [Changing host]
Tuor has joined #ruby
tsujp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
absolutejam has joined #ruby
jottr has quit [Ping timeout: 245 seconds]
<dannysantos>
no help, for newcomers...?
<mjacob>
dannysantos: it's unclear what you're asking
ur5us_ has quit [Remote host closed the connection]
<dannysantos>
ok mjacob
<dannysantos>
you have read the stackoverflow link right?
<mjacob>
yes
<dannysantos>
ok
<dannysantos>
so, ask me more to help me better explain it
<mjacob>
dannysantos: what exactly doesn't work?
<dannysantos>
well, I'm making an Jekyll Plugin... I don't know if you familiar with Jekyll...?
<mjacob>
no, i'm not
<mjacob>
it's probably a good idea to ask in #jekyll, if you haven't already
<dannysantos>
yeah, those guys dont seem to know either how to hit the keyboard or reply to people
<dannysantos>
://
<dannysantos>
probably is reply to people
<mjacob>
dannysantos: irc is not a paid support channel
<mjacob>
people might be in different time zones etc.
<dannysantos>
yeah, irc is the right place because my plugin won't be paied also, i'm not receiving any money to write it, and it will be open-source
<dannysantos>
ok
<mjacob>
i'd suggest to wait for a few hours more
<dannysantos>
yeah, already did that yestaerday without success
<dannysantos>
me comming to #ruby is a desperate measure
<mjacob>
in the stackoverflow question you're saying "I need help with this "Jekyll processing" part", but it's a bit unclear what doesn't work exactly
<dannysantos>
ok :)
<phaul>
is there a development forum for jekyl, maybe on github issues
tsujp has joined #ruby
<dannysantos>
jekyll processes files that have front-matter and also processes .md and .scss and .sass files so what I meant is to do that processing. What is a better way to phrase this?
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
grilix has quit [Ping timeout: 244 seconds]
krandi has joined #ruby
andikr has quit [Ping timeout: 272 seconds]
jenrzzz has quit [Ping timeout: 245 seconds]
throstur has joined #ruby
<throstur>
I have a problem with multiline string with double quote literal, I have an XML string with "quotes" inside it, all of it is enclosed in """ triple quotes """, what am I doing wrong?
<throstur>
I read something about HEREDOC, is this use case right for that construct?
<throstur>
(it seems to work, I'm just not confident about the usage being okay)
<adam12>
throstur: I always prefer heredoc to tripple quotes. Bonus points if you can use a squiggly heredoc (> Ruby 2.3 I think?)
<throstur>
thanks adam12! that's what I've ended up using for that more beautiful indentation
<adam12>
>= Ruby 2.3 rather.
<throstur>
could you recommend some ruby cheat-sheet resources that you like? I've just read why's poignant guide to ruby and that isn't exactly the best resource to look things up in :)
<leitz>
I woke up around 0115 this morning. By 2-ish I was pulling out a Go lang book, but switched back to Ruby.
<nius>
lol
<nius>
go's cool
brool has joined #ruby
<phaul>
Go to C is what Plan9 is to Unix :)
<leitz>
nius, I was in a webinar by Jay McGavren; he wrote "Head First Ruby" and also "Head First Go". I asked if Go was as fast as Ruby in prototyping new code, he said that nothing is as fast as Ruby, for that.
thomas_25 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lalitmee has joined #ruby
orbyt_ has joined #ruby
lalitmee has quit [Max SendQ exceeded]
lalitmee has joined #ruby
rsenic has joined #ruby
queip has joined #ruby
fran__ has quit [Quit: fran__]
psilly0 has joined #ruby
jottr has quit [Ping timeout: 268 seconds]
nowhere_man has joined #ruby
<psilly0>
hi all, i am using sequel gem to write one row in a DB. What would be a good spec test for this?
lalitmee has quit [Remote host closed the connection]
<phaul>
psilly0: I think this depends. First thing that comes to mind: don't test that your gems do what they promise they do. A bunch of integration tests are good to make sure the app is put together correctly, but otherwise you can assume that sequel is bug free (from testing perspective)
<psilly0>
would it be a good spec test to just open a db connection and read the table its going to write to?
<phaul>
I think if you already buy into the idea of reaching the real DB with the tests, then you would need to set up a test DB rails style.
<phaul>
A separate DB with predictable and fixed content prior to run each test case.
<phaul>
Otherwise after some time you would end up with tests passing/failing based on test order
<phaul>
But stubbing out the sequel layer altogether could also work.
<leitz>
psilly0, doing what phaul says is something I'm learning. Everything I've seen says that it's the way to go, I'm just still getting up my "go".
sh7d_ has quit [Quit: meh]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Inline has quit [Quit: Leaving]
sh7d has joined #ruby
Tempesta has quit [Read error: Connection reset by peer]
<psilly0>
ok thanks all
<psilly0>
i am very new to ruby
za1b1tsu has quit [Remote host closed the connection]
thomas_25 has joined #ruby
Tempesta has joined #ruby
orbyt_ has joined #ruby
orbyt_ has quit [Client Quit]
shwouchk has joined #ruby
gix has joined #ruby
kitallis- has joined #ruby
kitallis- has quit [Client Quit]
thomas_25 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
thomas_25 has joined #ruby
wickedbloodfart has joined #ruby
orbyt_ has joined #ruby
amateur_rubyist has quit [Remote host closed the connection]
hiroaki has joined #ruby
amateur_rubyist has joined #ruby
r29v has joined #ruby
amateur_rubyist has quit [Ping timeout: 248 seconds]
amateur_rubyist has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
amateur_rubyist has quit [Remote host closed the connection]
amateur_rubyist has joined #ruby
Ven`` has joined #ruby
amateur_rubyist has quit [Read error: Connection reset by peer]
ravenous_ has joined #ruby
jenrzzz has joined #ruby
za1b1tsu has joined #ruby
queip has quit [Ping timeout: 272 seconds]
kitallis| has joined #ruby
deepreds1 has joined #ruby
jenrzzz has quit [Ping timeout: 244 seconds]
<leftylink>
so the scoping thing was my TIL for today, but I'm also wondering, "am I ever going to have an occasion to use this knowledge"
tdy has joined #ruby
<leftylink>
well, none comes to mind immediately, but I guess that's the thing with some of these things. you just don't know, so you just have to file it away and hope it comes back to you at an appropriate time
<leftylink>
and maybe more about building the intuition so that you can apply it to a wide variety of situations
<leftylink>
"the scoping thing" being my messages from 07:03:58 today (it's 17:44 now)
queip has joined #ruby
deepredsky has joined #ruby
x86sk has joined #ruby
deepreds1 has quit [Ping timeout: 245 seconds]
Inline has joined #ruby
deepredsky has quit [Ping timeout: 272 seconds]
za1b1tsu has quit [Ping timeout: 245 seconds]
r29v has quit [Ping timeout: 248 seconds]
<nius>
leftylink: what's that?
<nius>
if/else having their own variable scopes?
jenrzzz has joined #ruby
za1b1tsu has joined #ruby
dionysus69 has joined #ruby
r29v has joined #ruby
ropeney_ has joined #ruby
ropeney has quit [Ping timeout: 258 seconds]
Freshnuts has joined #ruby
al-damiri has joined #ruby
sauvin has quit [Read error: Connection reset by peer]
za1b1tsu has quit [Read error: Connection reset by peer]
za1b1tsu has joined #ruby
<phaul>
nius: they don't have their own variable scope
<phaul>
defs are lexical scopes and there are a bunch of others. blocks can make a scope with variables explicitly declared block local. But flow control structures aren't
<nius>
why does above code result in "undefined local variable or method `a'" then, phaul?
ellcs has joined #ruby
ellcs has quit [Max SendQ exceeded]
<phaul>
because if the declaration like a = 1 appears lexically (phisically in the source file) after the usage it is undeclared
<phaul>
swap the useage and the declaration and it works
ellcs has joined #ruby
<phaul>
what matters is where it is in the code, within a single lexical scope
<nius>
oh just the physical location in the code matters?
<nius>
why is it that way?
<phaul>
yes. it's a confusing feature of Ruby
<phaul>
things like a = 1 if false # make a declared! even if a = 1 doesn't ever run
<phaul>
but only declared after it appears
<nius>
that makes a bit more sense to me
<phaul>
but this is the same with loops. while false; a = 1; end also makes a declared. But then it also doesn't matter on which iteration a = 1 happens
za1b1tsu has quit [Remote host closed the connection]
za1b1tsu has joined #ruby
john2496 has quit [Remote host closed the connection]
john2496 has joined #ruby
<leftylink>
lol "In spite of these Ruby's behaviors, we have a good news! The present SAT sover does not suffer from the issues because the program cannot return solutions in practical time for inputs with variables more than 40.
<leftylink>
best sentence I read today so far
<psilly0>
HAHAHAHA [:)
john2496 has quit [Remote host closed the connection]
john2496 has joined #ruby
john2496 has quit [Remote host closed the connection]
john2496 has joined #ruby
john2496 has quit [Remote host closed the connection]
john2496 has joined #ruby
john2496 has quit [Remote host closed the connection]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
grilix has quit [Ping timeout: 245 seconds]
grilix has joined #ruby
fphilipe_ has joined #ruby
schneider has quit [Ping timeout: 258 seconds]
x86sk has quit [Quit: Connection closed for inactivity]
robotcars has joined #ruby
<robotcars>
service I use is going to deploy a breaking change tomorrow, and i'm trying to set the code up to switch to it without issue. the column is being renamed from 'name' to 'asset_name' and I want to ensure that right now it, uses name, but when asset_name is implemented I don't have to restart… it will just pick it up when the new messages are polled…
<robotcars>
is there anything wrong with doing it this way?
fphilipe_ has quit [Ping timeout: 245 seconds]
john2496 has quit [Remote host closed the connection]
<phaul>
you are not talking about hot swapping code, right?
za1b1tsu has quit [Remote host closed the connection]
m3ssia has joined #ruby
<phaul>
Oh I see I think, the code is already swapped to the new one, but the service will change later. got it.
<robotcars>
i'm swapping code, table columns everything… this one line takes the value from the message
<robotcars>
but I don't want there to be an interruption.. ie all real time traffic.
GodFather has joined #ruby
<robotcars>
i dont want to restart the daemon to get the update and i want it to be seemless until i remove the old 'name'
<robotcars>
so that's the edit I'm trying to make, all other refereces to 'name' are now 'asset_name', but the current messages are sending 'name', sometime in the next 24 hours it will send 'asset_name'
<robotcars>
my way is working in test, but was wondering if there's a safer way
<phaul>
or just (body['asset_name'] || body['name'])&.to_s ?
<robotcars>
all 3 seem to work
absolutejam has quit [Ping timeout: 268 seconds]
<robotcars>
thanks havenwood and phaul. i think I'm going with the fetch.
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
hays has quit [Ping timeout: 264 seconds]
<leftylink>
hmm, those seem clear. if the problem were that the value could be at one of, say, 10 different keys, one would likely try somethng different, but with just two these all seem good
wildtrees has quit [Remote host closed the connection]
john2496 has joined #ruby
wildtrees has joined #ruby
sameerynho has joined #ruby
grilix has quit [Ping timeout: 272 seconds]
thomas_25 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cd has joined #ruby
reber has quit [Remote host closed the connection]
hiroaki has quit [Ping timeout: 246 seconds]
sameerynho has quit [Ping timeout: 248 seconds]
jottr has joined #ruby
orbyt_ has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
a0s510 has joined #ruby
a0s510 has quit [Quit: Leaving]
a0s510 has joined #ruby
jinie has quit [Ping timeout: 268 seconds]
jottr has quit [Ping timeout: 268 seconds]
a0s510 has quit [Quit: Leaving]
a0s510 has joined #ruby
a0s510 has quit [Client Quit]
a0s510 has joined #ruby
jinie has joined #ruby
matthewd has quit [Ping timeout: 252 seconds]
matthewd has joined #ruby
aecepoglu[m] has quit [Ping timeout: 252 seconds]
iotatron[m] has quit [Ping timeout: 252 seconds]
teej has joined #ruby
aecepoglu[m] has joined #ruby
iotatron[m] has joined #ruby
a0s510 has quit [Quit: Leaving]
a0s510 has joined #ruby
SeepingN has joined #ruby
orbyt_ has joined #ruby
jenrzzz has quit [Read error: Connection reset by peer]
Swyper has joined #ruby
<leftylink>
ah yes I mentioned I managed to shoot myself in the foot and get confused when to_s doesn't return a string
<leftylink>
so you should probably not do that
<leftylink>
&>> class Thing; def initialize(x) @x = x end; def to_s; @x end end; puts "#{Thing.new(1)} #{Thing.new(?a)}"