apeiros_ changed the topic of #ruby-lang to: Ruby 2.0.0-p0: http://ruby-lang.org (Ruby 1.9.3-p392) || Paste >3 lines of text on http://gist.github.com
mrsolo has quit [Quit: Leaving]
gearaholic has quit [Remote host closed the connection]
setmeaway has joined #ruby-lang
brianpWins has quit [Quit: brianpWins]
xmesg has quit [Remote host closed the connection]
marr has quit [Ping timeout: 252 seconds]
fosky has quit [Remote host closed the connection]
lguardiola has joined #ruby-lang
alessio_rocco has joined #ruby-lang
kain has joined #ruby-lang
erpuds has joined #ruby-lang
jkline has quit [Quit: jkline]
rwk1 has joined #ruby-lang
idkazuma has quit [Remote host closed the connection]
rwk1 has quit [Ping timeout: 256 seconds]
athaeryn has quit [Remote host closed the connection]
Markvilla has joined #ruby-lang
vlad_starkov has joined #ruby-lang
sepp2k1 has quit [Remote host closed the connection]
benanne has quit [Quit: kbai]
xxaM has quit [Ping timeout: 260 seconds]
xxaM has joined #ruby-lang
athaeryn has joined #ruby-lang
Markvilla has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
vlad_starkov has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
srbaker has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
vlad_starkov has quit [Read error: Connection reset by peer]
vlad_starkov has joined #ruby-lang
vlad_starkov has quit [Read error: Connection reset by peer]
vlad_starkov has joined #ruby-lang
jxie has quit [Quit: leaving]
asunderland has joined #ruby-lang
pskosinski_ has joined #ruby-lang
pskosinski has quit [Disconnected by services]
pskosinski_ is now known as pskosinski
symm- has quit [Ping timeout: 256 seconds]
io_syl has joined #ruby-lang
krohrbaugh has quit [Read error: Operation timed out]
musl has quit [Quit: WeeChat 0.4.0]
musl has joined #ruby-lang
rwk1 has joined #ruby-lang
rwk1 has quit [Ping timeout: 252 seconds]
vlad_starkov has quit [Ping timeout: 258 seconds]
asunderland has quit [Ping timeout: 256 seconds]
mikestok has joined #ruby-lang
toretore has quit [Quit: This computer has gone to sleep]
alessio_rocco has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
steveyken has joined #ruby-lang
idkazuma has joined #ruby-lang
jovy88 has quit [Read error: Connection reset by peer]
hahuang65 has quit [Quit: Computer has gone to sleep.]
jovy88 has joined #ruby-lang
pskosinski has quit [Quit: pskosinski]
steveyken has quit [Quit: Leaving]
vlad_sta_ has joined #ruby-lang
vlad_sta_ has quit [Read error: Connection reset by peer]
vlad_sta_ has joined #ruby-lang
zachlatta has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 268 seconds]
DomKM has quit [Quit: Leaving.]
scottschecter has quit [Ping timeout: 252 seconds]
scottschecter has joined #ruby-lang
vlad_sta_ has quit [Ping timeout: 252 seconds]
kgrz has joined #ruby-lang
MartynKeigher has quit [Excess Flood]
kgrz has quit [Ping timeout: 252 seconds]
rwk1 has joined #ruby-lang
mistym has quit [Remote host closed the connection]
rwk1 has quit [Ping timeout: 256 seconds]
mikestok has quit [Quit: Computer has gone to sleep.]
spuk has joined #ruby-lang
ahs3- has quit [Remote host closed the connection]
Asher1 has joined #ruby-lang
Asher has quit [Ping timeout: 240 seconds]
vlad_starkov has joined #ruby-lang
amerine has quit [Ping timeout: 264 seconds]
amerine has joined #ruby-lang
erpuds has quit [Quit: erpuds]
vlad_sta_ has joined #ruby-lang
io_syl has quit [Quit: Computer has gone to sleep.]
vlad_starkov has quit [Ping timeout: 245 seconds]
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
adam_ has quit [Quit: Leaving]
adam_ has joined #ruby-lang
vlad_sta_ has quit [Remote host closed the connection]
rwk1 has joined #ruby-lang
lguardiola has quit [Quit: Leaving]
stevenliu has joined #ruby-lang
rwk1 has quit [Ping timeout: 252 seconds]
rippa has joined #ruby-lang
stevenliu has quit [Ping timeout: 245 seconds]
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
jxie has joined #ruby-lang
lsegal has joined #ruby-lang
krohrbaugh has joined #ruby-lang
krohrbaugh has quit [Client Quit]
hahuang65 has joined #ruby-lang
vlad_starkov has joined #ruby-lang
breakingthings has quit []
Smol has quit [Ping timeout: 240 seconds]
stevechiagozie has joined #ruby-lang
stevechiagozie has quit [Remote host closed the connection]
Smol has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 252 seconds]
charliesome_ has joined #ruby-lang
plains has quit [Ping timeout: 258 seconds]
plains has joined #ruby-lang
swav_ has quit [Remote host closed the connection]
plains has quit [Ping timeout: 258 seconds]
rwk1 has joined #ruby-lang
hahuang65 has quit [Quit: Computer has gone to sleep.]
rwk1 has quit [Ping timeout: 255 seconds]
TheNotary has joined #ruby-lang
rwk1 has joined #ruby-lang
jkline has joined #ruby-lang
jkline has quit [Client Quit]
DomKM has joined #ruby-lang
krohrbaugh has joined #ruby-lang
krohrbaugh has quit [Ping timeout: 256 seconds]
rue has quit [Remote host closed the connection]
rue has joined #ruby-lang
skade has joined #ruby-lang
charliesome_ is now known as charliesome
mytrile has joined #ruby-lang
swav has joined #ruby-lang
<erikh> zenspider: nice job on minitest 5, looking forward to using it.
<erikh> are you still planning to do maintenance for 4.7?
rwk1 has quit [Remote host closed the connection]
rwk1 has joined #ruby-lang
tbuehlmann has joined #ruby-lang
kgrz has joined #ruby-lang
tomzx_mac has quit [Quit: return 0;]
rwk1 has quit [Ping timeout: 256 seconds]
tomzx_mac has joined #ruby-lang
r0bglees0n has quit [Read error: Connection reset by peer]
athaeryn has quit [Remote host closed the connection]
r0bgleeson has joined #ruby-lang
sush24 has joined #ruby-lang
zachlatta has quit [Remote host closed the connection]
krohrbaugh has joined #ruby-lang
rwk1 has joined #ruby-lang
<rue> Oh hey
krohrbaugh has quit [Ping timeout: 258 seconds]
kgrz has quit [Quit: Computer has gone to sleep.]
rwk1 has quit [Ping timeout: 256 seconds]
r0bby_ has joined #ruby-lang
cod3r has joined #ruby-lang
cod3r has quit [Ping timeout: 245 seconds]
sush24 has quit [Read error: Connection timed out]
sush24 has joined #ruby-lang
<erikh> hi
wallerdev has quit [Quit: wallerdev]
agarie has quit [Quit: Leaving...]
kgrz has joined #ruby-lang
mytrile has quit [Remote host closed the connection]
cod3r has joined #ruby-lang
sush24 has quit [Ping timeout: 248 seconds]
krohrbaugh has joined #ruby-lang
sush24 has joined #ruby-lang
krohrbaugh has quit [Client Quit]
jxie has quit [Quit: leaving]
sush24 has quit [Ping timeout: 256 seconds]
tbuehlmann has quit [Read error: Connection reset by peer]
blacktulip has joined #ruby-lang
r0bby_ has quit [Read error: Connection reset by peer]
DomKM has quit [Quit: Leaving.]
r0bby_ has joined #ruby-lang
mucker has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
r0bby_ has quit [Ping timeout: 256 seconds]
Gabri has joined #ruby-lang
rwk1 has joined #ruby-lang
Mon_Ouie has quit [Ping timeout: 245 seconds]
zachlatta has joined #ruby-lang
sush24 has joined #ruby-lang
francisfish has joined #ruby-lang
rwk1 has quit [Ping timeout: 248 seconds]
mhenrixon has joined #ruby-lang
dc5ala has joined #ruby-lang
TheNotary has quit [Quit: Leaving]
rwk1 has joined #ruby-lang
mistym has quit [Remote host closed the connection]
brianpWins has joined #ruby-lang
brianpWins has quit [Client Quit]
francisfish has quit [Remote host closed the connection]
krohrbaugh has joined #ruby-lang
sush24_ has joined #ruby-lang
sush24 has quit [Ping timeout: 256 seconds]
krohrbaugh has quit [Read error: Operation timed out]
skade has joined #ruby-lang
kgrz has quit [Quit: Computer has gone to sleep.]
vlad_starkov has joined #ruby-lang
glebm has quit [Ping timeout: 252 seconds]
vlad_starkov has quit [Ping timeout: 245 seconds]
odcinek has joined #ruby-lang
odcinek has quit [Client Quit]
Karql has joined #ruby-lang
brianpWins has joined #ruby-lang
kgrz has joined #ruby-lang
nertzy2 has joined #ruby-lang
tomzx_mac has quit [Ping timeout: 256 seconds]
nertzy has quit [Ping timeout: 264 seconds]
sush24_ has quit [Ping timeout: 256 seconds]
Mon_Ouie has joined #ruby-lang
Scorix has joined #ruby-lang
Scorix has quit [Client Quit]
Scorix has joined #ruby-lang
r0bby_ has joined #ruby-lang
<matti> zzak: Do you happen to know if #7106 will go into .1?
tommylommykins has quit [Read error: Operation timed out]
io_syl has joined #ruby-lang
chorkpop has joined #ruby-lang
chorkpop has quit [Read error: Connection reset by peer]
krohrbaugh has joined #ruby-lang
tommylommykins has joined #ruby-lang
krohrbaugh has quit [Ping timeout: 256 seconds]
francisfish has joined #ruby-lang
divout has joined #ruby-lang
lacrosse has quit [Ping timeout: 245 seconds]
JohnBat26 has joined #ruby-lang
vlad_starkov has joined #ruby-lang
sush24 has joined #ruby-lang
dingus_khan has joined #ruby-lang
<dingus_khan> hi everyone, I'm trying to sort an array of integers *without* using the .sort method built into ruby, or by hand in other words. I must be retarded or something, or the lack of sleep has caught up to me, because I can't stare at this long enough for it to make sense: http://pastebin.com/N3DsAPyY
<dingus_khan> I know it must be something obvious, but for some reason I'm fried on this one.
vlad_starkov has quit [Ping timeout: 240 seconds]
<matti> dingus_khan: Why do you bother?
<matti> .sort is quite efficient.
<dingus_khan> I know, I totally just want to use .sort, but I'm trying to do it without it, just to say that I can figure the logic out. this is becoming an embarrassing expose on my lack of formal logic training or computer science background, lol
sush24 has quit [Ping timeout: 248 seconds]
sush24 has joined #ruby-lang
<dingus_khan> I also haven't been able to find any written material on manually sorting an array in ruby, or any language for that matter. even the C++ examples I saw used a library function to do it, sigh
stamina has joined #ruby-lang
lacrosse has joined #ruby-lang
<Mon_Ouie> One sorting algorithm I like is merge sort. At every step, you split the array in halves, sort the new arrays, then "merge" them (that is, you combine them while keeping the new array sorted, which is easy since the two halves are already sorted)
zachlatta has quit [Remote host closed the connection]
<dingus_khan> ah, that's kind of what I was wondering--I'm sort of getting into the computer science aspect of things now, aren't I? like sorting algorithms and methods and all that? something that I definitely want to learn, but I'm still stumbling around in the basics basement
sush24 has quit [Ping timeout: 245 seconds]
<dingus_khan> I guess I need to go read about sorting algorithms then, and how to do all that? also, implementation in ruby... probably straightforward? I need sleep, d'oh...
<Mon_Ouie> Here's the one I had written: https://gist.github.com/5472366
<whitequark> dingus_khan: my qsort impl: https://twitter.com/whitequark/status/312242715389751297
<Mon_Ouie> but yes, you're more likely to find interesting explanations that are language agnostic (although they might still use an actual programming language for code samples)
<dingus_khan> neat, thanks for the examples!
<dingus_khan> also, whitequark, I definitely don't understand some of what's going on there--is qsort a method you're defining or a library function in ruby?
<whitequark> dingus_khan: I'm defining one
glebm has joined #ruby-lang
<dingus_khan> scratch that, I don't understand even half of what I see there, lol. are the asterisks like the passing by address feature in C++? I haven't gotten there yet
rippa has quit [Ping timeout: 240 seconds]
<whitequark> dingus_khan: nope :) it's so-called splat
<whitequark> easier to demonstrate
<whitequark> >> [ 1, 2, [ 3, 4 ]]
<eval-in> whitequark => [1, 2, [3, 4]] (http://eval.in/17716)
<whitequark> >> [ 1, 2, *[ 3, 4 ]]
<eval-in> whitequark => [1, 2, 3, 4] (http://eval.in/17717)
<whitequark> i.e. it "unpacks" an array "inline"
<whitequark> depending on your background, you can also call it "quasiquoting" or "a kind of syntactic sugar for array concatenation"
<whitequark> when used in the method arguments, splat has the reverse meaning
<whitequark> def foo(a, b, *rest); puts "#{a} #{b} #{rest}"; end; foo(1, 2, 3, 4)
<whitequark> >> def foo(a, b, *rest); puts "#{a} #{b} #{rest}"; end; foo(1, 2, 3, 4)
<eval-in> whitequark => 1 2 [3, 4] ... (http://eval.in/17718)
<dingus_khan> oh right, I saw that it made a one dimensional array out of the two. I had heard of splat before, now that you call it that, but it was when I was reading about ruby method taking variable numbers of arguments
<whitequark> yup... unary * has two different meanings when used in the formal argument declaration or in actual argument list
<dingus_khan> no kidding. you can tell I'm a super noob, then, lol. much more reading to do. Eloquent Ruby has been a slow read, little advanced for me at this point. do you mind if I copy and take notes on the code that you've posted?
symm- has joined #ruby-lang
mrfelix has joined #ruby-lang
zachlatta has joined #ruby-lang
adam_ has quit [Quit: Leaving]
sush24 has joined #ruby-lang
mbj has joined #ruby-lang
zachlatta has quit [Remote host closed the connection]
jxie has joined #ruby-lang
<dingus_khan> goodnight!
dingus_khan has quit [Quit: Page closed]
ikrima has quit [Quit: Computer has gone to sleep.]
krohrbaugh has joined #ruby-lang
jstemmer has joined #ruby-lang
ikrima has joined #ruby-lang
sush24 has quit [Read error: Connection timed out]
sush24 has joined #ruby-lang
krohrbaugh has quit [Read error: Operation timed out]
goshakkk has joined #ruby-lang
lsegal` has joined #ruby-lang
symm- has quit [Ping timeout: 258 seconds]
lsegal has quit [Read error: Connection reset by peer]
sush24 has quit [Ping timeout: 248 seconds]
io_syl has quit [Quit: Computer has gone to sleep.]
Gabri has quit [Remote host closed the connection]
goshakkk has quit [Quit: Textual IRC Client: www.textualapp.com]
runeb has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
lsegal` has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
<charliesome> "RGENGC (ristricted generational GC for CRuby/MRI) is ready!! wait a minute for release message." - https://twitter.com/_ko1/status/328084545347940352
<whitequark> wow
marr has joined #ruby-lang
zachlatta has joined #ruby-lang
ikrima has quit [Quit: Computer has gone to sleep.]
benanne has joined #ruby-lang
Scorix has quit [Quit: Leaving]
<ddfreyne> \o/
brianpWins has quit [Quit: brianpWins]
jxie has quit [Quit: leaving]
blacktul_ has joined #ruby-lang
blacktulip has quit [Ping timeout: 258 seconds]
mrfelix has quit [Quit: Computer has gone to sleep.]
nofxx has quit [Ping timeout: 258 seconds]
judofyr has joined #ruby-lang
<judofyr> anyone got details on RGENCC?
<erikh> blaaaah
<erikh> so jumpy
<ddfreyne> judofyr: I don’t think so, but I’d really like t oknow
<judofyr> erikh: what's up?
<erikh> not much really
<erikh> you?
<judofyr> chilling :)
<erikh> don't smoke it all at once
runeb has quit [Remote host closed the connection]
adambeynon has joined #ruby-lang
io_syl has joined #ruby-lang
io_syl has quit [Client Quit]
celinedior has joined #ruby-lang
sush24 has joined #ruby-lang
kgrz has quit [Quit: Computer has gone to sleep.]
sepp2k has joined #ruby-lang
workmad3 has joined #ruby-lang
sush24 has quit [Read error: Connection timed out]
sush24 has joined #ruby-lang
Nisstyre has quit [Read error: Connection reset by peer]
MaddinXx has joined #ruby-lang
workmad3 has quit [Ping timeout: 255 seconds]
krohrbaugh has joined #ruby-lang
<charliesome> >> return &lol # cc whitequark
<eval-in> charliesome => /tmp/execpad-804a76e7fd6d/source-804a76e7fd6d:2: block argument should not be given ... (http://eval.in/17747)
<charliesome> that error message
krohrbaugh has quit [Ping timeout: 256 seconds]
beiter has joined #ruby-lang
vlad_starkov has joined #ruby-lang
sush24 has quit [Read error: Connection timed out]
sush24 has joined #ruby-lang
divout has quit [Quit: Leaving.]
vlad_starkov has quit [Ping timeout: 258 seconds]
skade has joined #ruby-lang
<ddfreyne> I just realised why Koichi’s nick is ko1. D’oh!
gjaldon has joined #ruby-lang
xcombelle has joined #ruby-lang
skade has quit [Quit: Textual IRC Client: www.textualapp.com]
nickchow has joined #ruby-lang
jstemmer has quit [Quit: leaving]
faces has quit [Read error: No route to host]
face has joined #ruby-lang
io_syl has joined #ruby-lang
gjaldon_ has joined #ruby-lang
adambeynon has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
gjaldon has quit [Ping timeout: 264 seconds]
melter has quit [Read error: Operation timed out]
melter has joined #ruby-lang
sockat has joined #ruby-lang
ft51 has joined #ruby-lang
jstemmer has joined #ruby-lang
ft51 has quit [Client Quit]
sockat has quit [Quit: Leaving]
tbuehlmann has joined #ruby-lang
sush24 has quit [Ping timeout: 256 seconds]
divout has joined #ruby-lang
sush24 has joined #ruby-lang
AndChat| has quit [Ping timeout: 258 seconds]
sepp2k has quit [Remote host closed the connection]
krohrbaugh has joined #ruby-lang
nickchow has quit [Quit: Leaving...]
wadso has joined #ruby-lang
krohrbaugh has quit [Ping timeout: 256 seconds]
joshH2 has quit [Ping timeout: 248 seconds]
nickchow has joined #ruby-lang
crudson has quit [Ping timeout: 248 seconds]
wadso has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
ikrima has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 258 seconds]
sush24 has quit [Read error: Connection timed out]
sush24 has joined #ruby-lang
nickchow has quit [Quit: Leaving...]
adambeynon has joined #ruby-lang
<tbuehlmann> aww, come on.. just got a precedence thingy. https://gist.github.com/tbuehlmann/5472976 <-- is that really `(foo = nil) or 42`?
zachlatta has quit [Remote host closed the connection]
<tbuehlmann> that one totally got me
<darix> and yes "and"/"or" have a very low precedence
<tbuehlmann> this one time I wanted to be clever and use or instead of ||, silly me
nickchow has joined #ruby-lang
<whitequark> do not use or/and. not worth it.
sush24 has quit [Read error: Connection timed out]
sush24 has joined #ruby-lang
jxie has joined #ruby-lang
retro|cz has quit [Ping timeout: 246 seconds]
<charliesome> whitequark: so i tried to add direct threading to my vm
<charliesome> and the compiler optimized my entire interpreter away
nickchow has quit [Read error: Connection reset by peer]
wallerdev has joined #ruby-lang
<whitequark> charliesome: did you use the GNU computed goto extension?
<charliesome> whitequark: i did, but i used inline asm to get addresses for each instruction
<whitequark> charliesome: &&label ;)
<charliesome> whitequark: that's only visible inside the function though
<whitequark> otherwise it's a valid transformation
<whitequark> mmmm no
malev has joined #ruby-lang
sush24 has quit [Read error: Connection timed out]
<whitequark> I believe there was a certain hack which made them visible outside of a function
<charliesome> interesting
jovy88 has quit [Read error: Connection reset by peer]
<charliesome> so yeah right now i expose a bunch of globals
<charliesome> and i extern them from compile.c
sush24 has joined #ruby-lang
<rking> charliesome: Sweet exploit thing, BTW.
jovy88 has joined #ruby-lang
<charliesome> rking: haha thanks
<whitequark> charliesome: which exploit
<charliesome> whitequark: the class renaming one
<charliesome> i presume
<whitequark> ah
adambeynon has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
<charliesome> whitequark: do you happen to know of this hack which makes labels visible outside functions?
krohrbaugh has joined #ruby-lang
glebm has quit [Ping timeout: 252 seconds]
<whitequark> charliesome: searching for it now, also asked at #llvm
<charliesome> cheers
<charliesome> doing a bunch of hunting but no luck
<charliesome> i wonder if there's hacks possible with a static array declaration inside the function
<whitequark> hrm
<whitequark> I should look into JSC
glebm has joined #ruby-lang
krohrbaugh has quit [Read error: Operation timed out]
<whitequark> it is... enormous
<charliesome> lol
<whitequark> charliesome: hah, no, no such hack
vlad_starkov has joined #ruby-lang
justinram has joined #ruby-lang
<charliesome> hahaha
<charliesome> i considered that actually
<charliesome> lol
<charliesome> cool i'll give that a shot
<whitequark> however...
<whitequark> >#if USE(GCC_COMPUTED_GOTO_WORKAROUND)
<whitequark> I wonder about this
<whitequark> also <3 this
<whitequark> #define WTF_USE_GCC_COMPUTED_GOTO_WORKAROUND (ENABLE(COMPUTED_GOTO_CLASSIC_INTERPRETER) && !defined(__llvm__))
<charliesome> hahaha
<whitequark> WTF is an internal namespace of Webkit
<whitequark> so if you're using WTF:: in your code... well, wtf?!
<whitequark> awesome
<whitequark> self-commenting code
<charliesome> i wonder if people complaining that MRI isn't even valid C code know about all this stuff in nearly every interpreter ever
<whitequark> charliesome: ummm
<whitequark> yes
<whitequark> that part does not exhibit UB
<charliesome> it's not valid C code though
<whitequark> by definition. it requires, for example, a very intricate and significant addition to LLVM IR
<whitequark> charliesome: yes, but it is valid extended C code
<charliesome> either way
<whitequark> it won't even compile as C, but it will work correctly and without exhibiting UB with a corresponding extended C compiler
<charliesome> i'm pretty sure 90% of c programs out there rely on undefined behaviour
<whitequark> rely? no.
<whitequark> you cannot rely on UB
<charliesome> or invoke undefined behaviour
<whitequark> you can rely on UB having platform-specific semantics, indeed
<whitequark> charliesome: yes, and this is why C sucks
<whitequark> there's research which shows that most C programs indeed do this, and it in practice results in bugs and security holes
rwk1 has quit [Remote host closed the connection]
<whitequark> most often this happens when you move from x86 to something else
rwk1 has joined #ruby-lang
<whitequark> x86 has one of strictest memory orderings out there, eats unaligned access, and is generally forgiving
sush24 has quit [Read error: Connection timed out]
<whitequark> do you know what's the result of (int32_t)1 << 32 ?
sush24 has joined #ruby-lang
<charliesome> whitequark: undefined i'm guessing
<charliesome> otherwise no clue
<charliesome> i know overflows on signed values tend to be undefined
<whitequark> UB. in practice, it is 0 on x86 and 1 on PPC, of course, if your compiler did not take advantage of the UB and rewrote it to something completely unrelated
<whitequark> they don't "tend" to be undefined. signed overflow is always undefined
<whitequark> this also plays quite unexpectedly with integer promotion rules
<charliesome> i wasn't sure if all signed overflow was undefined or just some/most
<whitequark> all. do you know why exactly is it UB?
<whitequark> originally, because C was meant to run on non-2's-complement machines
<whitequark> I mean there is no such working silicon (or tubes?) for two or three decades already
<whitequark> then, they didn't remove it in C99/C11 because it gives a significant perf improvement for some tight loops... I'm unsure of the exact details
<whitequark> but probably it helps to assume that with for(int i = 0; i < ...; i++) i won't be negative
rwk1 has quit [Ping timeout: 258 seconds]
* whitequark wants to take a bunch of nails, engrave "CORRECTNESS IS MORE IMPORTANT THAN SPEED" on them, and then find out where people on the ISO C committee live
<whitequark> there is also a lot of very weird things related to INT_MIN definition... check it out
<whitequark> # define INT16_MIN (-32767-1)
<whitequark> you know why is it defined like dat? because -32768, despite being a representable negative number, is UB as of itself.
goshakkk has joined #ruby-lang
postmodern has quit [Remote host closed the connection]
malev has quit [Remote host closed the connection]
<whitequark> other UB: 1 / 0; dereferencing a NULL pointer.
<whitequark> both are pretty fun. they are not defined to trap, and, in the latter case, not defined to even attempt to access memory at address 0 (even if you're in an OS kernel!).
<whitequark> you can take clang and it will compile *((int*)0) to nothing at -O3, or to a memory access at -O0. fun.
adambeynon has joined #ruby-lang
toretore has joined #ruby-lang
<whitequark> charliesome: also there's a case where signed division leads to overflow. this is definitely my favorite.
jbsan has quit [Ping timeout: 246 seconds]
<charliesome> whitequark: heh yeah
<charliesome> aka the bug that can crash many interpreters
<whitequark> what else... there's the case when x == -x
justinram has quit [Remote host closed the connection]
<charliesome> whitequark: where x != 0
<charliesome> ?
<whitequark> charliesome: yep
<charliesome> whaaat
<whitequark> INT_MIN == -INT_MIN, under 2's complement rules
<whitequark> but! signed overflow is UB. so if you try to actually take advantage of that, you're screwed
justinram has joined #ruby-lang
<whitequark> highly recommend http://blog.regehr.org/archives/213
<charliesome> whitequark: that null pointer thing is actually pretty funny
<charliesome> especially if you're writing C for 16 bit real mode
xcombelle has quit [Remote host closed the connection]
<whitequark> charliesome: don't. just don't
<charliesome> (does anyone do that?)
vlad_sta_ has joined #ruby-lang
runeb has joined #ruby-lang
justinram has quit [Ping timeout: 245 seconds]
<whitequark> charliesome: lemme guess
<whitequark> near pointers to the start of the segment?
<charliesome> whitequark: well that too
<charliesome> but the IVT sits at the beginning of memory
<whitequark> ah
<whitequark> access to IVT cannot be performed from C ;)
<whitequark> I believe it is even used as a canonical example
<charliesome> so you can't handle ISR 0 in C
<charliesome> ISR 1 is ok :p
vlad_starkov has quit [Ping timeout: 276 seconds]
<whitequark> charliesome: you can't set up a handler for the interrupt #0 from C if your IVT is located at VA 0
<charliesome> this is real mode we have no virtual addresses
<whitequark> charliesome: doesn't matter
<whitequark> this is as valid for long mode
<whitequark> errr, how the fuck was it called
<whitequark> 16-bit mode with PM descriptors
<charliesome> unreal mode?
<whitequark> right.
* whitequark giggles
<charliesome> lol
<whitequark> no one promised you that with C you could access the entirety of the address space
<whitequark> I believe 0xFFFFFFFF is special too
ikrima has quit [Quit: Computer has gone to sleep.]
<whitequark> oh also null pointer not necessarily has integer value 0
<whitequark> and this was indeed abused by various DPMI extenders
<whitequark> and yeah, you could test a non-0 null pointer with if(ptr != 0)
<charliesome> i've heard of that
<charliesome> didn't know anyone actually did it
<whitequark> almost every worst C feature was actually used by someone
<whitequark> hell, clang explicitly takes advantage of most of the UB
<whitequark> interestingly, where the order of evaluation is not defined, clang still does it in lexical order in practice
<whitequark> I find it rather hilarious that at the point when compilers could actually take advantage of most of UB, hardware advanced so much that you don't really need that
<whitequark> also: >C++ explicitly allows an implementation of delete to zero out an lvalue operand, and I had hoped that implementations would do that, but that idea doesn't seem to have become popular with implementers.
<whitequark> why the hell no one does that
<charliesome> that seems like a good idea
<charliesome> actually
<whitequark> exactly
<charliesome> that seems like the thing that could be optimized away statically
<whitequark> hm... no
<charliesome> as in
<charliesome> "i can tell this variable being deleted is never used again, i won't bother zeroing"
<charliesome> "i'm not sure, better zero"
<whitequark> well, you see
<whitequark> C doesn't exactly work like dat
<charliesome> how come?
rwk1 has joined #ruby-lang
<charliesome> gcc seems pretty good at telling me when i have unused variables
<whitequark> using a variable after deletion is always UB
<charliesome> sure, so if you're going to perhaps crash anyway
<whitequark> err, a dynamically allocated memory after deallocation
<charliesome> may as well take the speed hit and zero out the variable
<whitequark> charliesome: you don't get it
<whitequark> C is all about NOT taking the speed hit
<whitequark> optimized C, at least.
sush24 has quit [Read error: Connection timed out]
<whitequark> so if it CAN avoid writing to memory, which potentially results in pretty huge penalty... the compiler would
sush24 has joined #ruby-lang
<whitequark> that's how every single optimization is implemented in practice
goshakkk has quit [Quit: Computer has gone to sleep.]
<whitequark> so, adding logic which is conservative wrt/ UB goes against everything else in the optimizer
<charliesome> fair enough
<whitequark> actually, if it can prove that a variable which was deleted is being used, it will rather delete the code which uses it
<whitequark> because, to a C compiler, it means that there is an invariant which it cannot see and which guarantees that the code which uses the variable is never executed anyway
<whitequark> this is a very bad way of reasoning but it is unfortunately logically sound...
<zzak> lol
<zzak> i cant figure how to pgup in screen now
<whitequark> zzak: pgup works for me
<zzak> oh
<zzak> SHIFT+Fn+up
io_syl has quit [Quit: Computer has gone to sleep.]
<zzak> matti: !
rwk1_ has joined #ruby-lang
<zzak> matti: idk, you should ping the ticket
<zzak> if its a bug, and you wanted it in .1 then need a patch and backport
<zzak> whitequark: now how to switch irssi windows...
<zzak> it works sometimes when you hold ESC then hit num, but thats slow
<whitequark> zzak: alt+<number>?
<ddfreyne> Does Ruby have undefined behavior?
<whitequark> ddfreyne: No.
<zzak> whitequark: £™£´™¢™£¢™£∞£¢¡
<zzak> lol
<whitequark> ddfreyne: OTOH, Ruby as it is used, does not have a specification as well.
<zzak> thats what happens when i hit alt num
<whitequark> zzak: your terminal is screwed up :/
<zzak> its osx
<whitequark> what's your $TERM?
<lianj> zzak: alt+num oder alt+arrows
rwk1 has quit [Ping timeout: 258 seconds]
<ddfreyne> whitequark: Ah yeah :)
<charliesome> ddfreyne: some people might say all of ruby is undefined behaviour :p
<zzak> lianj: whitequark neither work on osx term
<whitequark> charliesome: LOL
<charliesome> interestingly
<charliesome> it seems ruby goes to some lengths to make things more consistent between platforms
<charliesome> at the cost of performance
<zzak> charliesome: you use irssi?
<charliesome> zzak: nah textual
<whitequark> charliesome: yep... that's how it should work.
<zzak> damn, how does this thing work
<charliesome> same for opt_mod too
<whitequark> zzak: maybe there's some mismatch between TERM on your server and on your client
<whitequark> probably
<charliesome> it seems if the signs of the operands to % are different, the sign of the result is undefined
<whitequark> charliesome: indeed
<charliesome> so ruby reimplements % itself
<whitequark> god, C11 is 701 pages
<zzak> whitequark: yeah the server is bsd with xterm
<lianj> zzak: "/window num" ofc also works, but that one is really slowish
jbsan has joined #ruby-lang
<charliesome> zzak: bsd
<zzak> lianj: its honestly faster than Esc option
<charliesome> nice
<zzak> for short can just do /win
<zzak> wi 1
<zzak> wi works too
<zzak> guess i just wont use irc as much
baba has joined #ruby-lang
cod3r has quit [Ping timeout: 258 seconds]
<charliesome> zzak: how come you're connecting through a server
<whitequark> charliesome: interesting... I can't find the -2/-2 part in the C standard
<whitequark> charliesome: however there's 6
<whitequark> When integers are divided, the result of the / operator is the algebraic quotient with any
<whitequark> fractional part discarded.88) If the quotient a/b is representable, the expression
<whitequark> (a/b)*b + a%b shall equal a.
<zzak> charliesome: eric gave me a shell, for screen+irssi
<matti> zzak: Its depressing that people care fuck all about conributuons from non-core members.
<zzak> charliesome: /whois zzak :D
<zzak> matti: not true
<zzak> you just have to be persuasive
<charliesome> matti: where do you get that idea?
<matti> charliesome: Personal Experience(TM)
<zzak> charliesome: you use iterm?
<charliesome> zzak: yeah
<matti> zzak: I get it, I need to write a book about Rails, then be noisy on Twitter and declare myslef a Code Ninja.
<matti> zzak: Then they will do something ;p
* matti is being sarcastic.
<matti> zzak: :)
<zzak> charliesome: any quick way to switch terminal tabs other than cmd+shift+{ ?
<charliesome> zzak: cmd 1 through 9 works
<zzak> matti: not true, im a total loser
<whitequark> charliesome: hah, C11 removed gets()
<zzak> charliesome: for me that changes windows, not tabs
<charliesome> whitequark: brilliant
<charliesome> zzak: what really?
krohrbaugh has joined #ruby-lang
<charliesome> zzak: what version?
<zzak> charliesome: Terminal 2.3
<charliesome> zzak: oh i use item2
<charliesome> iterm2
<zzak> ahh
<matti> zzak: Haha, come on... ;p
<zzak> i dont want all the extras
<charliesome> whitequark: do you know why there aren't more functions in the stdlib which will allocate for you?
<zzak> iterm is much better than gnome shell
<charliesome> zzak: the extras are all good stuff
<charliesome> and if you don't use them, they won't hurt you
<charliesome> whitequark: for example, sometimes i just want to read a line and i don't want to have to do it myself
goshakkk has joined #ruby-lang
<whitequark> charliesome: there are extensions, like %a in GNU scanf
<whitequark> (which conflicts with C99 in a weird way afaik)
<whitequark> but... I dunno
sush24 has quit [Read error: Connection timed out]
<spike|spiegel> charliesome: umm fgets?
<charliesome> spike|spiegel: you have to tell it how big the buffer is
<whitequark> spike|spiegel: no
sush24 has joined #ruby-lang
<charliesome> spike|spiegel: i just want to say "i don't care, allocate it for me and i'll free it when i'm done"
<spike|spiegel> yeah so?
krohrbaugh has quit [Ping timeout: 252 seconds]
<charliesome> char* str = better_gets(); /* do shit */ free(str); is fine
<whitequark> charliesome: a c guy answered with "so you'd know that your piece of sw will explode if someone feeds it 10GB of data"
<whitequark> as this is both valid reasoning and exceptionally shitty in practice I guess this is correct
<charliesome> whitequark: it explodes at the moment anyway so i'm not particularly worried
<whitequark> charliesome: explode != UB
<whitequark> ah
<whitequark> I think I get it
<whitequark> what would better_gets() do if malloc() returns NULL?
<whitequark> return NULL? then you've leaked memory
<whitequark> return pointer? then it didn't do what you expected it to and you don't know about that
<charliesome> it would blow up in well defined flames
<whitequark> set a mandatory int* flag? ummmm
<whitequark> charliesome: no
<spike|spiegel> C is not your ruby for you to be lazy
<whitequark> OOM is not an error in C
justinram has joined #ruby-lang
<charliesome> that's what i'm talking about!
<charliesome> readline has a pretty easy api as well
goshakkk has quit [Quit: Textual IRC Client: www.textualapp.com]
<charliesome> zzak: it might be useful to mention yaml security considerations in the ri docs you just added, should i go ahead and add that?
rippa has joined #ruby-lang
<zzak> charliesome: fo sho
tarruda has joined #ruby-lang
tarruda has quit [Client Quit]
tarruda has joined #ruby-lang
_if has joined #ruby-lang
<judofyr> woah, a 1k LoC library for validation: https://github.com/mbj/aequitas
tarruda has quit [Client Quit]
<judofyr> this thing is almost Turing complete: https://github.com/mbj/aequitas/tree/master/lib/aequitas/matcher
<whitequark> wow, what a neat example of how to not do OO
<judofyr> also, am I the only one who hates the YARD whitespace style? https://github.com/mbj/aequitas/blob/master/lib/aequitas/instance_methods.rb
tarruda has joined #ruby-lang
<whitequark> without removing any meaning
sepp2k has joined #ruby-lang
glebm has quit [Ping timeout: 255 seconds]
vlad_sta_ has quit [Ping timeout: 245 seconds]
cored has quit [Ping timeout: 245 seconds]
judofyr has quit [Read error: No route to host]
glebm has joined #ruby-lang
judofyr has joined #ruby-lang
vlad_starkov has joined #ruby-lang
idkazuma has quit [Remote host closed the connection]
Banistergalaxy has joined #ruby-lang
dc5ala has quit [Quit: Ex-Chat]
vlad_starkov has quit [Ping timeout: 252 seconds]
sush24 has quit [Quit: This computer has gone to sleep]
<judofyr> whitequark: I'm actually working on a validation library myself: http://hastebin.com/kabadijesi.rb
<judofyr> it works sort-of backwards as opposed to Rails' validation: here you start with the input and then call methods that checks the input
nyuszika7h has quit [Remote host closed the connection]
<judofyr> instead of first defining validations, and then passing data as a parameter
nyuszika7h has joined #ruby-lang
<judofyr> makes it possible to do some cool stuff: field(:foo).required.regexp(/\d+/).map { |x| x.to_i }.match(1..100)
vlad_starkov has joined #ruby-lang
<judofyr> and then form.output[:foo] would be a Fixnum between 1 and 100
<whitequark> judofyr: ummm, java-style validations? :(
<whitequark> are they imperative or still declarative?
<judofyr> whitequark: imperative
<whitequark> so I cannot export them to e.g. javascript
<judofyr> whitequark: not sure what Java-style validations
<whitequark> thank you but I'd stick with AM validations
<whitequark> judofyr: method chaining is poor-man DSLs. Fowler recommends this in his book
vlad_sta_ has joined #ruby-lang
<whitequark> we need *less* imperative stuff not more :(
<judofyr> whitequark: correct, but I find that I always have to use custom validations, and then the JS-export doesn't work
<whitequark> judofyr: if there are multiple errors, can you get them all at once?
<judofyr> whitequark: yes
jovy88 has quit [Read error: Connection reset by peer]
vlad_sta_ has quit [Read error: Connection reset by peer]
vlad_starkov has quit [Ping timeout: 245 seconds]
vlad_sta_ has joined #ruby-lang
jovy88 has joined #ruby-lang
mistym has joined #ruby-lang
<mbj> judofyr: I did not released aequitas. It is an experiment.
<judofyr> whitequark: the main goal of Zorm::Form was to move the validations outside of the model (because you might have multiple possible validations).
<judofyr> the rest of the design might change
tarruda has quit [Quit: leaving]
tarruda has joined #ruby-lang
<judofyr> but this imperative design makes certain things easier: conditional validation (e.g. user info is required if you checked off for "Create an account")
<mbj> judofyr: It is a refactoring of dm-validations that is even worse. All of the matcher and logic will be deleted and delegated to the predicates in axiom https://github.com/dkubb/axiom
<mbj> judofyr: Just tried to do such stuff for myself to learn ;)
<whitequark> judofyr: um, :if => :valid?
<whitequark> not dat hard
<whitequark> and this actually forces you to write your code in a more declarative style
<whitequark> which is good
<judofyr> mbj: yeah, I think it's an interesting experiment (as all of DM2) :)
charliesome has quit [Quit: Textual IRC Client: www.textualapp.com]
<mbj> judofyr: The idea is capture enough information to generate javascript or other clientside validations.
<mbj> Bejond that stuff that is in html5 forms.
<judofyr> whitequark: another case: if type_id == 'image'; then require image_url and subject end; if type_id == 'location'; then require lat and lon; end
gjaldon_ has quit [Remote host closed the connection]
<judofyr> whitequark: how is that handled in Rails?
<whitequark> judofyr: ugh
<whitequark> first, don't do that
<whitequark> second, STI
<judofyr> this was for an external API
<whitequark> that is, you already did STI... so the idiomatic way to handle it would be to take advantage of it
<judofyr> if you ignore how to store it, how should a validation for this look?
<judofyr> delegate to a different validator depending on the value of type_id?
workmad3 has joined #ruby-lang
vlad_sta_ has quit [Remote host closed the connection]
krohrbaugh has joined #ruby-lang
imperator has joined #ruby-lang
arubin has joined #ruby-lang
<judofyr> it's very simple to define something declarative on top
krohrbaugh has quit [Ping timeout: 256 seconds]
<judofyr> validations.each do |key, type| field(key).send(type) end
<judofyr> I just don't see the need to limit the low-level validation-library to be declarative
<whitequark> judofyr: :if => :is_image?
<whitequark> and there is no such thing as a low-level validation library
<mbj> judofyr: If you want to serialize to js without having to reconstruct the logic via parsing the source you need to be declarative. IMHO
<judofyr> my experience with declarative validations have been that they solve the easy problems, but when you have more complex data structure, you need to do it "imperatively" anyway
<whitequark> judofyr: you present a user interface
retro|cz has joined #ruby-lang
<whitequark> it's not even about JS serialization... you're better off without any guarantees about sequence of execution herer
sush24 has joined #ruby-lang
<judofyr> mbj: yes. but I can rather write a declarative validation-thingie that only handles a subset that compiles nicely to both JS and Zorm::Form
beiter has quit [Quit: beiter]
<judofyr> whitequark: I've found that #map is very useful and avoids having double typechecks/conversions everywhere
<whitequark> judofyr: examples for both?
<judofyr> but then I also just don't get the idea of passing untrusted user-data directly to a model (Model.new(params[:model])
<mbj> judofyr: I have a dedicated (and sadly most of the times hand written) form parser object that responds to #attributes in between.
GeissT_ has quit [Quit: MillBroChat AdIRC User]
spuk has quit [Ping timeout: 256 seconds]
<judofyr> whitequark: field(:foo).regexp(/\d+/).map(&:to_i).match(1..100). when the validation finishes, the result hash will have an actual Fixnum
<mbj> judofyr: Model.new(FormParser.run(params[:model])) this object does all the coercion stuff needed.
<judofyr> mbj: does FormParser or Model do the coercion?
<mbj> judofyr: FormParser
<judofyr> mbj: and then how do you handle the case of between 1..100? (e.g. that validation can only run after you've converted the value to an int)
<mbj> judofyr: Also it can do form specific stuff if the cliend side form differs from the model in strucutre etc.
<judofyr> how is that dependency declared?
<whitequark> judofyr: btw
<whitequark> your regexp is broken
<whitequark> no \A\z
<judofyr> whitequark: #regexp adds it :)
<whitequark> also wtf is your #map
<whitequark> it's not #map if it does not operate on a collection
<whitequark> it's #convert or whatever
<judofyr> whitequark: it's more like a monad map
<whitequark> judofyr: we're in ruby
<mbj> judofyr: I typically only do validations in model, form parser only takes care if valid primitive coercion.
DomKM has joined #ruby-lang
<whitequark> #map which is not map is confusing in this context
<judofyr> whitequark: but it does work on collections too: fieldset(:categories).regexp(/\d+/)
<mbj> judofyr: Or in an external validator i build with aequitas.
<whitequark> judofyr: why I think you are very wrong here
<judofyr> { :categories => [1, 2, 3] }
<whitequark> you are conflating parsing user input and validating user input
<whitequark> validation is a part of model lifecycle
<whitequark> parsing user input, not so
<whitequark> so it's not DRY if you need more than one form
<whitequark> (or input from API, or ...)
<judofyr> whitequark: I don't see any gain of separating parsing user input and validating it
<whitequark> judofyr: because you are not validating user input
<judofyr> whitequark: I certainly don't want my model to parse user input
<whitequark> you are validating the model
<judofyr> yeah, I just don't get the idea of "an invalid model". why are we creating invalid models?!
<whitequark> you are enforcing invariants which refer to the model content, in other words
<whitequark> judofyr: and your technique very well allows creating invalid models
<whitequark> even more... they will slip under the rug and will be persisted
<judofyr> whitequark: example?
<whitequark> the fact that a person cannot have negative age has nothing with validating user input
<whitequark> it belongs to the model
<judofyr> whitequark: that I can agree with. it might be useful to have some validation on the model itself.
<whitequark> so... you must duplicate all your checking logic in every place you are operating with the age field
<whitequark> form input, API input, importing, whatever
<judofyr> whitequark: but it doesn't make sense to put every validation there
<whitequark> I think it might make sense to make composable validations
<whitequark> but rails' solution is far better than yours: it's more conservative
<yorickpeterse> herro
<whitequark> judofyr: (composable validations) as in, define them on both the model and the form parser
<whitequark> makes even more sense if you think about validations which make sense in a context
<whitequark> eg an admin can make another user an admin
<whitequark> but not a mere user
<whitequark> or: a moderator can make user an user or a moderator, but not admin
<whitequark> you get the idea
<judofyr> whitequark: I agree that composable validations can be useful. nothing is stopping me for moving Zorm::Form into that direction.
<whitequark> judofyr: please do...
spuk has joined #ruby-lang
<judofyr> whitequark: re: "you must duplicate all your checking logic": that's why the Field-object is public API in Form. you should be able to write a `def age_validations(field) field.required.integer.gt(0) end` and re-use that
<whitequark> judofyr: this is not "enforcing invariant"
<judofyr> brb
<whitequark> this is "moving code around"
rippa has quit [Ping timeout: 240 seconds]
sush24 has quit [Read error: Connection timed out]
sush24 has joined #ruby-lang
ivanoats has joined #ruby-lang
ivanoats has quit [Changing host]
ivanoats has joined #ruby-lang
justinram has quit [Remote host closed the connection]
My_Hearing has joined #ruby-lang
Mon_Ouie has quit [Disconnected by services]
My_Hearing is now known as Mon_Ouie
pskosinski has joined #ruby-lang
asunderland has joined #ruby-lang
sush24 has quit [Read error: Connection timed out]
sush24 has joined #ruby-lang
<judofyr> whitequark: from experience I haven't found model constraints very useful. I use nullable/unique-constraints in Postgres and that is most of the time good enough for me
gjaldon has joined #ruby-lang
asunderland has quit [Ping timeout: 252 seconds]
vlad_starkov has joined #ruby-lang
krohrbaugh has joined #ruby-lang
<spike|spiegel> db constraints should stay where they belong, in the database.
vlad_starkov has quit [Ping timeout: 264 seconds]
krohrbaugh has quit [Ping timeout: 268 seconds]
symm- has joined #ruby-lang
vlad_starkov has joined #ruby-lang
judofyr has quit [Remote host closed the connection]
sush24 has quit [Quit: This computer has gone to sleep]
tarruda has quit [Ping timeout: 256 seconds]
rking has quit [Ping timeout: 248 seconds]
erpuds has joined #ruby-lang
sush24 has joined #ruby-lang
rippa has joined #ruby-lang
workmad3 has quit [Ping timeout: 246 seconds]
rking has joined #ruby-lang
celinedior has quit [Quit: celinedior]
lsegal has joined #ruby-lang
francisfish has quit [Remote host closed the connection]
asunderland has joined #ruby-lang
spuk_ has joined #ruby-lang
<whitequark> spike|spiegel: except that ORMs don't handle the resulting error, AND different RDBMSes handle constraints differently, AND migrations are a PITA
<whitequark> so, no.
spuk has quit [Ping timeout: 264 seconds]
sush24 has quit [Quit: This computer has gone to sleep]
djwonk has joined #ruby-lang
mhenrixon has quit [Quit: Textual IRC Client: www.textualapp.com]
ivanoats has quit [Remote host closed the connection]
francisfish has joined #ruby-lang
adambeynon has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
tarruda has joined #ruby-lang
ivanoats has joined #ruby-lang
ivanoats has joined #ruby-lang
ivanoats has quit [Changing host]
adambeynon has joined #ruby-lang
erpuds has quit [Quit: erpuds]
nofxx has joined #ruby-lang
ivanoats has quit [Ping timeout: 276 seconds]
<spike|spiegel> whitequark: so don't go improve the 'ORM'... instead just fix it where you have control over? :)
sush24 has joined #ruby-lang
yfeldblum has quit [Ping timeout: 258 seconds]
<mbj> sush24:
<mbj> spike|spiegel, whitequark: I'd love to have support for both, and keeping them in sync automagically ;)
<mbj> This is especially nice if someone tries to do "adhoc" modificaions of the data in db. Without an ORM.
Asher1 has quit [Quit: Leaving.]
Asher has joined #ruby-lang
athaeryn has joined #ruby-lang
thatJasonSmith has quit [Ping timeout: 256 seconds]
asunderland has quit [Ping timeout: 264 seconds]
francisfish has quit [Remote host closed the connection]
jovy88 has quit [Read error: Connection reset by peer]
jovy88 has joined #ruby-lang
asunderland has joined #ruby-lang
krohrbaugh has joined #ruby-lang
bzalasky has joined #ruby-lang
benlovell has joined #ruby-lang
snarfmason has quit [Quit: Textual IRC Client: www.textualapp.com]
benlovell has quit [Client Quit]
adambeynon has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
krohrbaugh has quit [Ping timeout: 256 seconds]
yfeldblum has joined #ruby-lang
nofxx has quit [Remote host closed the connection]
sush24 has quit [Read error: Connection timed out]
sush24 has joined #ruby-lang
benlovell has joined #ruby-lang
justinram has joined #ruby-lang
<whitequark> spike|spiegel: ORMs can only use the least common denominator of RDBMSes
<whitequark> this is a shortcoming of an SQL standard, or, well, lack thereof... everything comes with its own quirks.
<whitequark> but this is the easier part
<whitequark> the more complex part is that you cannot validate your domain logic in your RDBMS unless you go full-on oracle with stored procedures and so on
<whitequark> *validate your domain-specific properties.
gix has quit [Ping timeout: 246 seconds]
<whitequark> so, in effect, you either need to move all of your domain logic to your RDBMS, or duplicate it here and there.
kgrz has joined #ruby-lang
<whitequark> mbj: no, this is not "nice". that is bad.
<whitequark> it gives you an illusion of consistency, and this bubble will pop when someone actually tries to persist the model
workmad3 has joined #ruby-lang
<mbj> whitequark: I do not really share this opinion. Kepping the db level constrains in sync, also if the model level validations cannot be represented 100% is a win. As it still guards for some error types.
goshakkk has joined #ruby-lang
<whitequark> mbj: you do not work directly with the DB, period. otherwise consistency of data cannot be guaranteed at all.
<whitequark> there is no such thing as "partially valid". it's either valid or not.
gix has joined #ruby-lang
<whitequark> (or: you work with the DB and ensure the consistency yourself.)
asunderland has quit [Ping timeout: 246 seconds]
<mbj> whitequark: heh, someone will work with your data outside of your rails/whatever app. With bad luck that guy is ordered to do a modification of the production db and that adhoc.
<whitequark> mbj: yeah exactly!
<whitequark> he'll work around the DB constraints but will break your domain constraints.
<whitequark> you'll update your app and his code will break.
<whitequark> so on.
<whitequark> what do you do? you export an API.
<mbj> scenario I had: operator/developer on holidays.
<xuser> you stop using ORMs!
<mbj> Inexperienced and junior developer was ordered to fix something.
<mbj> So he fired up the mysql cli and hacked his update statements in the production db.
<whitequark> mbj: awesome. this is an excellent example for a completely unrelated problem
goshakkk has quit [Client Quit]
<mbj> As he saw constraint related errors he called original operator in holidays and figured out he was about to break stuff ;)
<whitequark> I've already replied to it above and have no further comments
<whitequark> you CANNOT rely on DB constraints to ensure consistency of your data. it doesn't matter if you can reflect some of your validations into DB or not.
<whitequark> what you're saying is essentially "this library fixes 90% of SQL injections in a typical application"
<mbj> whitequark: I'm stopping my comments if you do ;) I accept your opinion. But I do not share it. No furser comments ;)
<whitequark> mbj: *shrug* it's that I had exactly your case in mind when I wrote the explanation above
<gjaldon> why is ack so fast? can a ruby equivalent of ack compete with it?
codejury_ has joined #ruby-lang
codejury has quit [Read error: Connection reset by peer]
<whitequark> gjaldon: I don't think your questions can be answered
benlovell has quit [Ping timeout: 268 seconds]
retro|cz has quit [Ping timeout: 255 seconds]
workmad3 has quit [Ping timeout: 264 seconds]
<rippa> gjaldon: It's fast because it only searches the stuff it makes sense to search.
<rippa> also it's in perl so it could be as fast if it were written in ruby
<whitequark> well... a) a combination of programming techniques and modern hardware b) depends on what do you call "ruby", what hardware do you run it at, and how much time are you going to spend writing it.
<gjaldon> whitequark: just thought i'd give it a try. i'm making a small ruby program that searches for methods recursively from the current directory
<gjaldon> i'm trying both ack and my small program on my machine
<gjaldon> so i guess hardware could be considered a constant
<whitequark> yep
<mbj> whitequark: Heh I was *shrug* after you wrote "I've already replied to it above and have no further comments
<mbj> whitequark: If you like to continue discussion no problem. I love to discuss those stuff ;)
<whitequark> mbj: "no further comments" for that particular example :)
gregf has joined #ruby-lang
<whitequark> also... it's funny that anyone actually needs to write "I accept your opinion". I guess the opposite is "go on a long, obscenity-filled rant"? Sad.
banisterfiend has quit [Ping timeout: 252 seconds]
<mbj> whitequark: heh turns out I got you wrong.
<whitequark> (someone who's a better writer than me should summarize all of that in a short essay "You and Your Fucking Opinion")
<mbj> hehe
<mbj> My idea on keeping the model and db validations even partiall in sync is NOT about to rely on the db side validations.
<mbj> It is about having an additional safety net.
<mbj> More like an assert statement ;)
<whitequark> mbj: you know that asserts are no-op in production, right?
<mbj> whitequark: you got me ;)
<mbj> Need to find another example
<mbj> Just have the additional safety net in the ring ;)
<whitequark> I'd say that "safety net" stuff makes sense in security, which (if you're not an idiot) most vulnerabilities require a combination of highly improbable circumstances
<whitequark> so you do layered security to guard those very rare edge cases
benlovell has joined #ruby-lang
<whitequark> but here, DB constraints miss *most* of the invariants you'd want to enforce
<mbj> Sure that safety net counts as mitigation
<whitequark> *if* the security analogue was right... you'd actually want to duplicate all of your domain logic in the DB
<whitequark> in case that somehow an invalid record slipped through the app
<mbj> If this is an automated progess I love duplication.
<whitequark> and maybe that even makes sense in some cases!
<mbj> s/progress/process/
<whitequark> mbj: and I hate complexity. It usually gets into my way, sooner or later.
<mbj> I'd not even try to do that sync by hand.
<yxhuvud> I see model validations as a way to protect against bad user input and db validation as a way to protect against bugs.
<mbj> It is a tradeoff, but as I had worked in projects where the database was the only shared part of the system. PHP-Frontend / Ruby-backend I saw the safety net in action. And this with "manually synced db constraints".
<yxhuvud> which make them pretty different in how I use them.
<whitequark> yxhuvud: but how do you express invariants which arise from your domain knowledge?
<whitequark> validates :state, in: %w(created opened closed resolved)
<yxhuvud> whitequark: depends on where the error can occur.
<whitequark> yxhuvud: a bug in application (a typo perhaps?) can set the state to an invalid value
gty has joined #ruby-lang
<whitequark> but this is not user input. the user only sends req's to workflow endpoints (/open /close etc)
goshakkk has joined #ruby-lang
<whitequark> mbj: where you cannot, by definition, share validations, yes, it might be an acceptable tradeoff
<whitequark> a milder form of "generate ruby and php code from a single description", maybe
<whitequark> but I would never use this as a "solution"; as a crutch, indeed, it works
<yxhuvud> whitequark: I'd use a single list of allowed states to populate available choices and then validate against the same list.
<whitequark> not one to be desired, but one to be deployed as the least evil.
<whitequark> yxhuvud: hm? there is no combo box at the UI side. there's a set of predefined API endpoints.
<whitequark> which correspond to transitions in a state machine
<whitequark> there's a ton of tasks which map to this pattern
<yxhuvud> that said, I have a single writer to the database I work against, so sharing the db is not something I have to deal with.
sush24 has quit [Read error: Connection timed out]
* whitequark is going to write an article on sensible comparisons of programming languages
sush24 has joined #ruby-lang
<yxhuvud> well, as a faulty input will put a nice error to the user I'd still put the validation in the model. But that may break down if you have multiple different writers to the same db.
<whitequark> yxhuvud: exactly my point
<whitequark> well, no, not really
<yxhuvud> I suppose using an enum could work as well if you are using postgres or another sane db.
countdigi has joined #ruby-lang
<yxhuvud> (they are utterly insane in mysql)
ikrima has joined #ruby-lang
<whitequark> I'll say this again: it's not for checking user input, it's for guarding against bugs
imperator has quit [Ping timeout: 245 seconds]
gjaldon has quit [Remote host closed the connection]
faen has quit [Ping timeout: 264 seconds]
krohrbaugh has joined #ruby-lang
faen has joined #ruby-lang
athaeryn has quit [Remote host closed the connection]
judofyr has joined #ruby-lang
tbuehlmann has quit [Remote host closed the connection]
sush24 has quit [Quit: This computer has gone to sleep]
krohrbaugh has quit [Ping timeout: 252 seconds]
gty has quit [Ping timeout: 245 seconds]
<judofyr> RGenGC looks nice
<judofyr> I mean, the best would be to introduce a whole new C-ext system
<judofyr> with write-barriers
sush24 has joined #ruby-lang
<whitequark> judofyr: mmm, what for?
<whitequark> just use FFI
<judofyr> whitequark: or do that
<judofyr> my point was mainly that RGenGC adds a generational GC without changing the C-exts
sush24 has quit [Quit: This computer has gone to sleep]
<yxhuvud> what is rgengc?
jovy88 has quit [Read error: Connection reset by peer]
<judofyr> see the attached PDF for description
jovy88 has joined #ruby-lang
goshakkk has quit [Quit: Computer has gone to sleep.]
<yxhuvud> I wish they would choose another name than write barriers though, since that has a *totally* different meaning when it comes to memory and code.
<judofyr> yxhuvud: huh? write barriers is used a lot on GC literature
<yxhuvud> hmm. so there are several already established uses for that term? *sigh*
ikrima has quit [Quit: Computer has gone to sleep.]
sush24 has joined #ruby-lang
<whitequark> yxhuvud: ummmm what?
<whitequark> it's a single meaning
<whitequark> or give an example
vlad_starkov has quit [Ping timeout: 255 seconds]
heftig has quit [Quit: Quitting]
<yxhuvud> a write barrier is a case of a memory barrier.
vlad_starkov has joined #ruby-lang
heftig has joined #ruby-lang
<whitequark> well yeah
<whitequark> it enforces a particular ordering
<whitequark> and is used to ensure that the memory you're going to access is in a consistent state
<whitequark> I'd say that GC write barrier does exactly that
sush24 has quit [Ping timeout: 248 seconds]
<yxhuvud> it will be nicely confusing whenever someone tries to implement a lockfree parallell GC.
<yxhuvud> well you get the same situation as when database tech refer to locks as latches since they already have a different use of it.
<whitequark> heh true
goshakkk has joined #ruby-lang
<yxhuvud> interesting spelling error in that bug title :)
sush24 has joined #ruby-lang
erikh has left #ruby-lang ["Linkinus - http://linkinus.com"]
mistym has quit [Remote host closed the connection]
sush24 has quit [Quit: This computer has gone to sleep]
crackit__ has joined #ruby-lang
djwonk has quit [Quit: djwonk]
ikrima has joined #ruby-lang
rwk1_ has quit [Remote host closed the connection]
rwk1 has joined #ruby-lang
<yxhuvud> nice improval of mark time.
tomzx_mac has joined #ruby-lang
benlovell has quit [Ping timeout: 245 seconds]
krohrbaugh has joined #ruby-lang
rwk1 has quit [Ping timeout: 246 seconds]
crackit__ has quit [Quit: Textual IRC Client: http://www.textualapp.com/]
krohrbaugh has quit [Ping timeout: 268 seconds]
brianpWins has joined #ruby-lang
sush24 has joined #ruby-lang
erpuds has joined #ruby-lang
sepp2k has quit [Remote host closed the connection]
Asher has quit [Ping timeout: 256 seconds]
judofyr has quit [Read error: No route to host]
vlad_starkov has quit [Remote host closed the connection]
ikrima has quit [Quit: Computer has gone to sleep.]
<spike|spiegel> Ruby's GC is still far from being not broken :)
sush24 has quit [Quit: This computer has gone to sleep]
rwk1 has joined #ruby-lang
tylersmith has joined #ruby-lang
vlad_starkov has joined #ruby-lang
MartynKeigher has joined #ruby-lang
benlovell has joined #ruby-lang
goshakkk has quit [Quit: Textual IRC Client: www.textualapp.com]
rwk1 has quit [Ping timeout: 276 seconds]
asunderland has joined #ruby-lang
mbj has quit [Quit: leaving]
thatJasonSmith has joined #ruby-lang
ikrima has joined #ruby-lang
thatJasonSmith has quit [Ping timeout: 272 seconds]
justinram has quit [Ping timeout: 252 seconds]
justinram has joined #ruby-lang
sepp2k has joined #ruby-lang
dettoaltrimenti has joined #ruby-lang
dettoaltrimenti has quit [Read error: Connection reset by peer]
thatJasonSmith has joined #ruby-lang
MartynKeigher has quit [Excess Flood]
tarruda has quit [Remote host closed the connection]
MartynKe- has joined #ruby-lang
erpuds has quit [Quit: erpuds]
dettoaltrimenti has joined #ruby-lang
ivanoats has joined #ruby-lang
ivanoats has quit [Changing host]
ivanoats has joined #ruby-lang
mucker has quit [Quit: leaving]
ivanoats has quit [Read error: Connection reset by peer]
ivanoats has joined #ruby-lang
ivanoats has quit [Changing host]
ivanoats has joined #ruby-lang
thatJasonSmith has quit [Ping timeout: 268 seconds]
asunderl1nd has joined #ruby-lang
asunderland has quit [Ping timeout: 260 seconds]
sush24 has joined #ruby-lang
JohnBat26 has quit [Ping timeout: 245 seconds]
erpuds has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
ivanoats has quit [Ping timeout: 245 seconds]
workmad3 has joined #ruby-lang
krohrbaugh has joined #ruby-lang
rwk1 has joined #ruby-lang
thatJasonSmith has joined #ruby-lang
krohrbaugh has quit [Ping timeout: 256 seconds]
thatJasonSmith has quit [Ping timeout: 256 seconds]
rwk1 has quit [Ping timeout: 256 seconds]
divout has quit [Remote host closed the connection]
justinra_ has joined #ruby-lang
justinram has quit [Ping timeout: 272 seconds]
Asher has joined #ruby-lang
workmad3 has quit [Ping timeout: 268 seconds]
benlovell has quit [Ping timeout: 268 seconds]
kgrz has quit [Quit: Computer has gone to sleep.]
thatJasonSmith has joined #ruby-lang
swygue has quit [Quit: Konversation terminated!]
spinky has joined #ruby-lang
heftig has quit [Quit: Quitting]
heftig has joined #ruby-lang
tylersmith has quit [Quit: tylersmith]
adambeynon has joined #ruby-lang
asunderland has joined #ruby-lang
sush24 has quit [Read error: Connection timed out]
sush24 has joined #ruby-lang
asunderl1nd has quit [Ping timeout: 260 seconds]
jovy88 has quit [Read error: Connection reset by peer]
jovy88 has joined #ruby-lang
brianpWins has quit [Quit: brianpWins]
thatJasonSmith has quit [Quit: thatJasonSmith]
sush24 has quit [Read error: Operation timed out]
sush24 has joined #ruby-lang
sush24 has quit [Ping timeout: 245 seconds]
runeb has quit [Remote host closed the connection]
MartynKe- has left #ruby-lang [#ruby-lang]
bizdak has joined #ruby-lang
thatJasonSmith has joined #ruby-lang
aymeric_ has joined #ruby-lang
adambeynon has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
ikrima has quit [Quit: Computer has gone to sleep.]
Banistergalaxy has quit [Ping timeout: 245 seconds]
Banistergalaxy has joined #ruby-lang
brianpWins has joined #ruby-lang
rippa has quit [Ping timeout: 240 seconds]
Qwak has quit []
ivanoats has joined #ruby-lang
vlad_starkov has joined #ruby-lang
t_ has quit [Ping timeout: 248 seconds]
amerine has quit [Quit: Computer has gone to sleep.]
ivanoats has quit [Ping timeout: 252 seconds]
krohrbaugh has joined #ruby-lang
t_ has joined #ruby-lang
ikrima has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 255 seconds]
krohrbaugh has quit [Ping timeout: 246 seconds]
ivanoats has joined #ruby-lang
ivanoats has joined #ruby-lang
ivanoats has quit [Changing host]
rwk1 has joined #ruby-lang
asunderland has quit [Ping timeout: 276 seconds]
ivanoats has quit [Ping timeout: 245 seconds]
rwk1 has quit [Ping timeout: 252 seconds]
runeb has joined #ruby-lang
wyhaines has joined #ruby-lang
ivanoats has joined #ruby-lang
rippa has joined #ruby-lang
imperator has joined #ruby-lang
runeb has quit [Ping timeout: 248 seconds]
ivanoats has quit [Ping timeout: 276 seconds]
mistym has joined #ruby-lang
mistym has joined #ruby-lang
mistym has quit [Changing host]
cored has joined #ruby-lang
cored has quit [Changing host]
cored has joined #ruby-lang
zachlatta has joined #ruby-lang
MaddinXx has quit [Remote host closed the connection]
ivanoats has joined #ruby-lang
thone_ has joined #ruby-lang
ivanoats has quit [Ping timeout: 240 seconds]
thone has quit [Ping timeout: 240 seconds]
hm99191 has joined #ruby-lang
hm99191 has quit [Client Quit]
ivanoats has joined #ruby-lang
ivanoats has joined #ruby-lang
ivanoats has quit [Changing host]
idkazuma has joined #ruby-lang
ivanoats has quit [Ping timeout: 276 seconds]
ivanoats has joined #ruby-lang
imperator has quit [Ping timeout: 276 seconds]
thatJasonSmith has quit [Quit: thatJasonSmith]
bzalasky has quit [Remote host closed the connection]
<somasonic> http://pastie.org/7730844 is there a clean way to do this?
ivanoats has quit [Ping timeout: 245 seconds]
cod3r has joined #ruby-lang
baba has quit [Ping timeout: 256 seconds]
<spike|spiegel> somasonic: what's not clean about it? you want to go meta with instance_variable_set?
<somasonic> spike|spiegel, nah it's just a bit long is all
joshH2 has joined #ruby-lang
bzalasky has joined #ruby-lang
ivanoats has joined #ruby-lang
ivanoats has quit [Changing host]
ivanoats has joined #ruby-lang
krohrbaugh has joined #ruby-lang
chessguy has joined #ruby-lang
agarie has joined #ruby-lang
ivanoats has quit [Ping timeout: 256 seconds]
ivanoats has joined #ruby-lang
tsion has quit [Quit: Leaving]
krohrbaugh has quit [Ping timeout: 256 seconds]
ivanoats has quit [Ping timeout: 272 seconds]
rwk1 has joined #ruby-lang
runeb has joined #ruby-lang
rwk1 has quit [Ping timeout: 256 seconds]
ivanoats has joined #ruby-lang
ivanoats has joined #ruby-lang
ivanoats has quit [Changing host]
TheNotary has joined #ruby-lang
ivanoats has quit [Ping timeout: 240 seconds]
sepp2k has quit [Remote host closed the connection]
ivanoats has joined #ruby-lang
mucker has joined #ruby-lang
jstemmer has quit [Quit: leaving]
ivanoats has quit [Ping timeout: 276 seconds]
jonahR has joined #ruby-lang
chessguy has quit [Remote host closed the connection]
ivanoats has joined #ruby-lang
ivanoats has quit [Changing host]
ivanoats has joined #ruby-lang
zachlatta has quit [Remote host closed the connection]
ivanoats has quit [Read error: Connection reset by peer]
ivanoats has joined #ruby-lang
ykk` has joined #ruby-lang
<ykk`> hey everyone
<ykk`> am writing a combat program where a player can damage a monster
<ykk`> does anyone have any resources that may be helpful towards that concept?
<ykk`> or experience
r0bby_ has quit [Max SendQ exceeded]
ivanoats has quit [Ping timeout: 252 seconds]
r0bby_ has joined #ruby-lang
stamina has quit [Ping timeout: 252 seconds]
ivanoats has joined #ruby-lang
ivanoats has quit [Read error: Connection reset by peer]
ivanoats has joined #ruby-lang
ivanoats has joined #ruby-lang
ivanoats has quit [Changing host]
spuk has joined #ruby-lang
spuk_ has quit [Ping timeout: 240 seconds]
brianpWins has quit [Remote host closed the connection]
brianpWins has joined #ruby-lang
ivanoats has quit [Ping timeout: 245 seconds]
jovy88 has quit [Read error: Connection reset by peer]
jovy88 has joined #ruby-lang
ivanoats has joined #ruby-lang
ivanoats has quit [Changing host]
ivanoats has joined #ruby-lang
justinra_ has quit [Remote host closed the connection]
ivanoats has quit [Read error: Connection reset by peer]
ivanoats has joined #ruby-lang
gty has joined #ruby-lang
ivanoats has quit [Ping timeout: 252 seconds]
gty has quit [Client Quit]
gty has joined #ruby-lang
gty has quit [Client Quit]
greenarrow has joined #ruby-lang
vlad_starkov has joined #ruby-lang
erpuds has quit [Quit: erpuds]
krohrbaugh has joined #ruby-lang
ivanoats has joined #ruby-lang
ivanoats has joined #ruby-lang
ivanoats has quit [Changing host]
bzalasky has quit [Remote host closed the connection]
asunderland has joined #ruby-lang
krohrbaugh has quit [Ping timeout: 246 seconds]
ivanoats has quit [Ping timeout: 245 seconds]
ivanoats has joined #ruby-lang
rwk1 has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 245 seconds]
asunderland has quit [Ping timeout: 252 seconds]
postmodern has joined #ruby-lang
ivanoats has quit [Ping timeout: 245 seconds]
ivanoats has joined #ruby-lang
ivanoats has quit [Changing host]
ivanoats has joined #ruby-lang
rwk1 has quit [Ping timeout: 264 seconds]
ivanoats has quit [Ping timeout: 248 seconds]
jacktrick has joined #ruby-lang
ykk` has quit [Quit: ykk`]
erpuds has joined #ruby-lang
marr has quit [Ping timeout: 252 seconds]
<TheNotary> ykk`: You still on?
aymeric_ has quit [Remote host closed the connection]
<TheNotary> talk more about your program. Is it text based? I never realized, but text based is a pretty chill place to start prototyping battle mechanics, because you don't have to keep stopping for dealing with the bs graphics stuff. It's so hard to be articulate in code with that stuff
<TheNotary> ack! I just missed him =(
<TheNotary> is he a regular?
<TheNotary> !seen
<TheNotary> !who ykk`
ivanoats has joined #ruby-lang
<TheNotary> anyway, there's a pink bug on my monitor, I've been hacking outside today due to the whether. I've decided not to squish the pink bug, he's being 'kewl'.
rippa has quit [Read error: Connection reset by peer]
rippa has joined #ruby-lang