ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.23.1 | Fund Crystal's development: | GH: | Docs: | API: | Gitter:
<FromGitter> <Sevensidedmarble> is there any reason theres no Dir.home to go along with Dir.current?
<FromGitter> <Sevensidedmarble> it'd be a nice little helper to not have to read from ENV["HOME"]
<FromGitter> <bew> Dir.current doesn't read the env
<FromGitter> <Sevensidedmarble> right but it'd still be nice to have dir.home
<FromGitter> <bew> No need for helpers, and it's more explicit that you want the user's home when you use the ENV, than if you'd use Dir.home
<FromGitter> <Sevensidedmarble> there are quite a bit of methods in the stdlib I'd probably call a helper however
<FromGitter> <Sevensidedmarble> ruby even more so
braidn[m] has joined #crystal-lang
kp666[m] has joined #crystal-lang
byteflame has joined #crystal-lang
tybee[m] has joined #crystal-lang
TheGillies has joined #crystal-lang
Renich has joined #crystal-lang
cptaffe has joined #crystal-lang
thelonelyghost has joined #crystal-lang
watzon has joined #crystal-lang
dtcristo has joined #crystal-lang
weston_[m] has joined #crystal-lang
sija[m] has joined #crystal-lang
<FromGitter> <Sevensidedmarble> is there anyway to compile changes to crystal such that it wont interfere with the version already installed to my /usr/bin?
<FromGitter> <bew> Huh just compile the crystal sources?
<FromGitter> <Sevensidedmarble> Where does it put the binary? I just don't wanna overwrite my crystal in /usr
<FromGitter> <Sevensidedmarble> Sorry if these are stupid questions lol
<bmcginty> sevensidedmarble: I've got my git crystal in projects/crystal; I link ~/bin/crystal2 to ~/projects/crystal/bin/crystal and just use crystal2 in place of crystal for commands.
<bmcginty> Sevensidedmarble: For git, I just run `make crystal release=1` whenever I want to update, and git pull before that to fetch changes.
faustinoaq has quit [Ping timeout: 268 seconds]
<FromGitter> <Sevensidedmarble> I get this output from trying to make std_spec: ⏎ ⏎ ```code paste, see link``` []
<FromGitter> <Sevensidedmarble> I'm pretty sure I have all the dependencies
<FromGitter> <Sevensidedmarble> I have the proper llvm version and the gc, I know that
<bmcginty> sevensidedmarbel: looking, one sec.
<FromGitter> <Sevensidedmarble> looks like I messed up the crystal version on my path somehow
<FromGitter> <Sevensidedmarble> because the crystal command doesnt work at all
<bmcginty> sevensidedmarbel: You're running out of memory. You Might be able to try make std_spec release=1 (basically, you want to turn off debugging). You may be out of luck building the full specs, dpeending on how muhc ram you have though.
<bmcginty> sevensidedmarbel: How much ram does your machine have? also, what distribution are you running?
<FromGitter> <Sevensidedmarble> 4 gigs, but chrome is using most of it lol
<FromGitter> <Sevensidedmarble> I cloned from github
<FromGitter> <Sevensidedmarble> I was trying to make some stdlib changes I wanted to suggest
<bmcginty> Sevensidedmarbel: You should be able to run just some of the spec related to what you're changing. Hav eyou been able to do `make crystal release=1`? IF so, you should be able to do ./bin/crystal to run the newly compiled crystal...
<FromGitter> <Sevensidedmarble> same thing, cannot allocate memory error
<FromGitter> <Sevensidedmarble> maybe I need to try it with chrome closed lol
<FromGitter> <pnloyd> Is there anywhere I can see at an example of compiling llvm IL/BC from `crystal build --emit=llvm-il`?
<FromGitter> <pnloyd> Iv'e been digging through Crystal's source but I'm having a hard time pin pointing the flags that are used.
<FromGitter> <pnloyd> llvm-ir*
gcds has joined #crystal-lang
<FromGitter> <pnloyd> nvm I figured it out.
expeditiousRubyi has joined #crystal-lang
<expeditiousRubyi> So... why doesn't Array have a to_slice method like String does?
<expeditiousRubyi> Was playing around with the icr REPL to test out a compute_crc function that operates on a Bytes object. Wanted to make a random test case, so naturally I started with an Array, since UTF-8 strings don't naturally make good ways to test binary data (even if it doesn't care if it's a valid encoding or not)
<expeditiousRubyi> To get from an array to Bytes, however, required the use of to_unsafe
<expeditiousRubyi> Given how trivial it was to implement... bytes =, ary.size) ... I'd say a to_slice method should have just been implemented outright on Array
<Guest76467> does range work? array[2..4]
<expeditiousRubyi> array[2..4] would just spit out another array, it seems
<Guest76467> ok, I didnät understand what you want with to_slice
<expeditiousRubyi> A simple method for converting an Array to a Slice that contains all of its members
Guest76467 is now known as csmrfx
<csmrfx> expeditiousRubyi: is that like cloning the members into a Slice?
<expeditiousRubyi> No, it's like making a slice from the Array's buffer
<expeditiousRubyi> A Slice is a pointer and a length field and nothing else
<expeditiousRubyi> String has a method called to_slice that'll make a slice from the string's buffer
<expeditiousRubyi> I'm wondering why Array doesn't have an equivalent method
<csmrfx> because an array slice is just an array?
<FromGitter> <codenoid> hi, i use `datanoise/` , but why i cant access multidimentional array, like `data_from_mongocr.each { |v| puts v["parent"]["child_data"] }`
<FromGitter> <codenoid> `undefined method '[]' for BSON::Code`
<expeditiousRubyi> csmrfx: despite responding to a number of the same methods, Slice and Array are not the same type, and so if one is using type restrictions, passing one to the other will not work.
<FromGitter> <codenoid> fixed with `JSON.parse v["parent"].to_s` but i think it's so bad
expeditiousRubyi has quit [Quit: Leaving]
<FromGitter> <codenoid> is there any alternative solution for that ?, or i will make helper method
balduin has joined #crystal-lang
rohitpaulk has joined #crystal-lang
balduin has left #crystal-lang [#crystal-lang]
lacour has quit [Quit: Leaving]
<FromGitter> <bew> @codenoid maybe `as_s` so it doesn't do any convertion
alex`` has joined #crystal-lang
<FromGitter> <bew> > We removed Array#to_slice because it would cause a segfault if you kept a reference to the slice returned from that method and the array was resized.
<FromGitter> <Rinkana> Morning
txdv has quit [Ping timeout: 240 seconds]
rohitpaulk has quit [Ping timeout: 268 seconds]
claudiuinberlin has joined #crystal-lang
txdv has joined #crystal-lang
<FromGitter> <crisward> Is it possible to get the Crystal version in a macro?
<vegai> simply {{ Crystal::VERSION }} ?
livcd has quit [Read error: Connection reset by peer]
Papierkorb_ has joined #crystal-lang
livcd has joined #crystal-lang
rohitpaulk has joined #crystal-lang
mark_66 has joined #crystal-lang
faustinoaq has joined #crystal-lang
gcds has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gcds has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
rohitpaulk has joined #crystal-lang
faustinoaq has quit [Quit: Konversation terminated!]
<Papierkorb_> gcds, When you btw get around to PR'ing the changes to bindgen (What did you need to do btw?), you of course have the honor of adding Mac OS X to the platform matrix in the README ;)
<Papierkorb_> And of course the `Contributors` section in there too if you fancy that.
<gcds> Papierkorb_ hehe :D I just disabled half of the file and hardcoded paths as I did not had much time to fix it correctly :D
<Papierkorb_> But only in, or other things too?
<gcds> just find_clang
rohitpaulk has quit [Ping timeout: 260 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <DRVTiny> Hello, dear All!
<Papierkorb_> Yo
<FromGitter> <sdogruyol> hey @DRVTiny
faustinoaq has joined #crystal-lang
<oprypin> i dont have anything positive to reply to that thread, so pass :|
<faustinoaq> opryin What hosting are you using for Critter? DigitalOcean? or something cheaper?
<oprypin> faustinoaq, Vultr
<FromGitter> <Rinkana> Hmm for momentum we need more news. Things like more (often) releases can be better for this. Like 0.24.0 is still a pre-release.
<FromGitter> <Rinkana> More releases gives you the opportunity to post more and also seem more active.
<oprypin> In my opinion, the only thing missing is people actually working on it but w/e
<FromGitter> <Rinkana> And things like helping that guy from RedHat. Getting it intergrated into an OS is a huge step
<Papierkorb_> oprypin: A clear vision of what the language is would also help
<FromGitter> <Rinkana> Oh wow BigDecimal has just been merged
<oprypin> nice
<oprypin> omg it was merged as separate commits
faustinoaq has quit [Quit: doing something]
faustinoaq has joined #crystal-lang
alex`` has quit [Quit: WeeChat 1.9.1]
<FromGitter> <mverzilli> ouch I screwed that up, sorry
<travis-ci> crystal-lang/crystal#1ccd22b (master - CR fixes): The build passed.
<vegai> Rinkana: !?
<vegai> oprypin: aww, I could've squashed it
<vegai> didn't realize it was this close
alex`` has joined #crystal-lang
<FromGitter> <mverzilli> no, it's my bad, I could have done it. I usually double check that but this time it slipped
<FromGitter> <sdogruyol> @mverzilli shit happens, don't worry
<vegai> thanks for the hand-holding on that PR, everyone :)
<FromGitter> <Sevensidedmarble> I'm kind of confused how macros really work
<FromGitter> <Sevensidedmarble> does the code actually get compiled as if you ran `crystal run` ?
<oprypin> ‎@Sevensidedmarble‎, crystal run is crystal build into termporary file and run the file
<FromGitter> <Sevensidedmarble> but is that how macros work?
<oprypin> I don't see why you're comparing macros to `crystal run`
<oprypin> so I guess the answer is no, that's not how macros work
<FromGitter> <Sevensidedmarble> I guess I'm not really understanding them
<oprypin> definitely
<FromGitter> <Sevensidedmarble> lol
<FromGitter> <Sevensidedmarble> I'm trying to build a parser in crystal
<oprypin> ‎@Sevensidedmarble‎, have you worked with templating languages like Jinja or somethin
<FromGitter> <Sevensidedmarble> and yes, I'm familiar with jinja2
<FromGitter> <Sevensidedmarble> I thought there was more going on for some reason
<oprypin> ‎@Sevensidedmarble‎, so imagine macros like macros in jinja2
<Papierkorb_> Sevensidedmarble, The macro code is interpreted (Macro code isn't Crystal, it just "happens to" look really similar to it), and then parsed into an AST. Then it's rerun until no more macro code is found (basically), and injected into the original place
<oprypin> and the {% {{ things as templates executed on the source code
<livcd> i am curious if Crystal reaches 1.0 before Nim :D
<livcd> sdogruyol: how is your book ? :0
<Papierkorb_> ... Mh I'm actually wondering if you'd be able to generate good C or C++ code out of Crystal
<Papierkorb_> I mean readable code, not "generated don't look at it" code
<FromGitter> <sdogruyol> @livcd it's ok
<FromGitter> <Sevensidedmarble> are you familiar with any other language parsing projects in crystal?
<Papierkorb_> what do you mean?
<Papierkorb_> Language implementated in Crystal? Or just parser toolkits?
<FromGitter> <Sevensidedmarble> well I'm working on a shell and I've gotten to the point where I really need an actual tokenizer/parser I feel, instead of the rudimentary system I have now
<Papierkorb_> Write a recursive-descent LL(k) parser
<Papierkorb_> Con: Sucks if you make big-ish changes to your grammar. Pro: Decent debugging capabilities (The stacktraces make sense)
<FromGitter> <sdogruyol> @Sevensidedmarble there's cltk
<FromGitter> <sdogruyol>
<FromGitter> <Sevensidedmarble> isnt that more for natural language?
<FromGitter> <Sevensidedmarble> as in human language? I dont know if thats the right term
<Papierkorb_> nope
<Papierkorb_> It's not a port of pythons `nltk`
<FromGitter> <Sevensidedmarble> hmm that lib is really interesting
<FromGitter> <Sevensidedmarble> I've never used any language parsing tools but I guess something like this would be the way to go
<Papierkorb_> Hash(K, V) sucks cause the insertion order is retained?
<FromGitter> <Sevensidedmarble> I think anyone who likes go's stdlib is probably not going to like crystal
<FromGitter> <sdogruyol> why?
<FromGitter> <Sevensidedmarble> its much smaller
<vegai> sdogruyol: are you writing a Crystal book?
<FromGitter> <sdogruyol> yes, I am
<FromGitter> <sdogruyol> haven't announced it though
<Papierkorb_> I mean it's perfectly fine that some people don't like Crystal. It has vastly different paradigms all around. That's fine, we don't need a second Go!
<vegai> sort of a general one, or one focused on Kemal?
<FromGitter> <sdogruyol> general
<Papierkorb_> because if we'd love Go .. we'd just use Go?
<vegai> all right :)
<FromGitter> <sdogruyol> @Papierkorb I agree with that
<FromGitter> <sdogruyol> thanks for your big decimal work @vegai 👍
<FromGitter> <Sevensidedmarble> In reference to that issue, I like the stdlib being huge
<FromGitter> <Sevensidedmarble> personally
<FromGitter> <Sevensidedmarble> but I also like pythons std lib a lot
<FromGitter> <Sevensidedmarble> which is king of useless modules
<FromGitter> <sdogruyol> I'm just in the middle...
<FromGitter> <sdogruyol> I definitely want to have `http` built-in but not sure about `OAuth` e.g
<FromGitter> <Sevensidedmarble> I like the insurance that the maintainers of the language are 'sanctioning' said package when its in the std lib, it gives the expectation that it will integrate and work better then a seperate tool
<FromGitter> <Sevensidedmarble> I also don't think OAuth would fit though
<Papierkorb_> No idea where OAuth even came from
<FromGitter> <Sevensidedmarble> simply because who's to say it might go the way of tk in ruby I guess
<FromGitter> <sdogruyol> then there's termios lol
<FromGitter> <sdogruyol> I don't even know what's that
<FromGitter> <Sevensidedmarble> yeah but termios isn't going away on linux any time soon
<FromGitter> <Sevensidedmarble> and I think its still very relevent to people doing raspberry pi stuff
<FromGitter> <sdogruyol> I'm not sure if it should reside in std
<FromGitter> <Sevensidedmarble> pretty sure python has a termios module in the library too
<FromGitter> <Sevensidedmarble> crystal also needs a pty package
<FromGitter> <Sevensidedmarble> module
<FromGitter> <bew> should be a shard that linux app/lib uses
<FromGitter> <sdogruyol> (I don't know any Python)
<FromGitter> <Sevensidedmarble> or maybe theres pty stuff in another module I didn't see
<Papierkorb_> There's no PTY stuff for Crystal :(
<FromGitter> <Sevensidedmarble> someone should really get on that
<FromGitter> <Sevensidedmarble> its in the ruby std lib, it couldnt be too hard to use that for inspiration
<FromGitter> <Sevensidedmarble> because I really wanna port some terminal emulator code to crystal
<Papierkorb_> ... I wouldn't use rubys stdlib for inspiration regarding API too much
<Papierkorb_> E.g., Deviating the Process API made it sooo much better
<FromGitter> <sdogruyol> ugh, we have a long standing rendering issue
<FromGitter> <sdogruyol> we need to fix that first
<FromGitter> <sdogruyol> let me find
<Papierkorb_> rendering?
<faustinoaq> Hi community, I think we should create a section on Crystal docs for and, those links by @ysbaddaden are very useful :)
<Papierkorb_> `at_ext{ STDOUT.blocking = false }` ?
<faustinoaq> @sdogruyol, I'm using zsh now and crystal works fine, I don't now why bash fails with crystal, maybe because diferent blocking state or something?
<Papierkorb_> zsh cleans up after returning to it
<Papierkorb_> Just like it makes sure the prompt is always starting on the first column, and not anywhere else
<FromGitter> <bew> @faustinoaq zsh has a fail safe when apps (like crystal) doesn't restore IO states correctly when quitting, bash des not
<faustinoaq> Oh, so zsh is doing something bad or good?
<Papierkorb_> And that doesn't always work >_>
<Papierkorb_> zsh is just good
<FromGitter> <bew> good for the user, bad for finding bugs in apps x)
<FromGitter> <sdogruyol> we can't rely on zsh, can we?
<faustinoaq> XD
<Papierkorb_> it doesn't fix changes to the raw mode though :|
<FromGitter> <bew> @sdogruyol well it's a crystal issue that will need a fix, we can't expect that everyone use zsh (sadly?)
<FromGitter> <Sevensidedmarble> doesnt seem to happen for me in fish
<FromGitter> <bew> Papierkorb row mode is termios related iirc, not io
<FromGitter> <bew> raw*
<Papierkorb_> yes, but zsh could still fix it
<FromGitter> <bew> true
<Papierkorb_> kinda annoying when a raw-mode process crashes and basically makes the terminal unusable
<Papierkorb_> "dude I liked this session!"
<FromGitter> <bew> `$ reset` doesn't fix that?
<Papierkorb_> never tried that
<FromGitter> <bew> it resets the termios to terminal's defaults
<faustinoaq> @bew, no, reset doesn't work
<FromGitter> <sdogruyol> "dude I liked this session!" LOL
<faustinoaq> just, `crystal eval 'STDOUT.blocking = false'`
<FromGitter> <bew> for crystal io issues it won't work, but for apps crashing in raw mode it should work
<faustinoaq> or reopen the bash terminal
<Papierkorb_> *bash
<faustinoaq> @bew "for apps crashing in raw mode it should work", Oh, thanks for the advice :)
<faustinoaq> Hey, I now this channel is using
<oprypin> hm?
<faustinoaq> and what are the features, I mean executing crystal code, I can't find a guide
<faustinoaq> I think is doing that, right?
<oprypin> yes
<faustinoaq> >>> print "it works?"
<DeBot_> faustinoaq: Syntax error in eval:17: unexpected token: > -
<faustinoaq> Oh, awesome! :)
<oprypin> but 2 >s not 3
<faustinoaq> Ok, Thanks you! (^-^)
<faustinoaq> >> [0x679bff14d, 0x2a4, 0x5cd88d86, 0xbe0ed].map(&.to_s(36)).join(" ") # Just one more :)
<DeBot_> faustinoaq: # => "crystal is pretty good" -
<FromGitter> <Sevensidedmarble> stupid question here
<FromGitter> <Sevensidedmarble> how do you escape a \ ?
<FromGitter> <Sevensidedmarble> it keeps not working for me lol
<oprypin> show example how it's not working
<wmoxam> >>> puts "\\"
<DeBot_> wmoxam: Syntax error in eval:17: unexpected token: > -
<FromGitter> <Sevensidedmarble> ` if input.ends_with? ('\')`
<FromGitter> <Sevensidedmarble> this breaks stuff
<oprypin> so use \\
<oprypin> uh use `\\`
rohitpaulk has quit [Ping timeout: 250 seconds]
<FromGitter> <Sevensidedmarble> without single quotes?
<oprypin> with
<Papierkorb_> '\''
<FromGitter> <Sevensidedmarble> it does work but the weird thing is when I read the string that has it it displays \\
<oprypin> ‎@Sevensidedmarble‎, the string is likely just fine but the way you display it is a string representation of the syntax you'd use to produce the string
<FromGitter> <Sevensidedmarble> that makes sense
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
ryan_ has joined #crystal-lang
<ryan_> Hi all, not sure if this is expected functionality. When using `dir = File.dirname(__FILE__)` in release code, it appears to be using the `src` instead. I'm trying to get the current working directory of the running program
<ryan_> I'm writing a wrapper script for some other scripts. The wrapper script may be called at any directory in the system, but the wrapper is in the same directory as the scripts it's calling
<jsn-> Of course it's expected functionality. What you want is probably Dir.current
<ryan_> Dir.current gets my current working directory and not the directory of the script
<jsn-> i think you're misusing the term; "current working directory" is what .current returns; you probably want File.dirname $0 or something
<oprypin> __FILE__ is the path to the current source file; PROGRAM_NAME is how the executable was started (so you can get the executable's directory from it); Dir.current is the current working directory; $0 **was** an alias to PROGRAM_NAME
<ryan_> oprypin, that has done the trick
<jsn-> oprypin, still works for me
<oprypin> gotta update your version then
<jsn-> 0.24 is not in archlinux yet, iirc
<oprypin> weird to see that Pre-release tag if it's never been used before
<RX14> it's weird that 0.24.0 isn't a release
<RX14> and we still havent solved packaging
<oprypin> what do you mean
<RX14> i should probably finish off my libgc
<RX14> oprypin, the 0.24.x release will be 0.24.1
<RX14> 0.24.0 will always be a prerelease
<RX14> since we tagged it now
<RX14> and pushed the tag
<oprypin> why is that so
<FromGitter> <sdogruyol> that's confusing
<oprypin> maybe it should be communicated better?
<FromGitter> <sdogruyol> @RX14 what's the difference of your libgc?
<oprypin> i just flagged the package out of date for Arch Linux
<RX14> @sdogruyol i meant my omnibus
<RX14> no oprypin
gcds has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RX14> it's not out of date
<RX14> it's a prerelease
<RX14> it literally says it at the top of the changelog
<oprypin> it's always a pre-release before 1.0
<RX14> no...
<oprypin> so it makes no sense
<RX14> no
<RX14> 0.23.1 is a release
<RX14> it's just pre-1.0
<RX14> it's not a prelrease
<oprypin> and so is 0.24.0 then
<RX14> no
<FromGitter> <sdogruyol> lol
<RX14> i didn't make this mess
<RX14> 0.23.1 is a release pre-1.0
<RX14> and we suggest people use it
<RX14> as their default crystal version
<RX14> 0.24.0 is a prelrease and we don't suggest people upgrade to it from 0.23.1
<oprypin> you have not communicated that at all
<FromGitter> <sdogruyol> why didn't we 0.24.0-pre at all?
<RX14> no i havent oprypin because i didn't make this mess
<RX14> it's a prerelease only to find bugs before releasing 0.24.1
<RX14> @sdogruyol bad planning i guess?
<RX14> it's a mess and i hope we can all agree not to make this mess again
<oprypin> i interpreted it as a totally normal release just that you for some reason made a new convention for marking releases
<RX14> nope
<FromGitter> <sdogruyol> I'm pretty sure a lot of library maintainers will have a lot of GH issues opened with this version confusion.
<oprypin> i get it now, no need to repeat! but that doesn't help much
<RX14> as i said
<RX14> i think its stupid too
<FromGitter> <sdogruyol> anyway hopefully 0.25.0 will be a new milestone
<RX14> no
<RX14> 0.24.1
<FromGitter> <sdogruyol> I'm not talking about that
<RX14> we typically don't do that
<RX14> we always milestone next
<FromGitter> <sdogruyol> I'm talking about the next major release after 0.24.1
<RX14> and then decide what to name it just before release
<FromGitter> <sdogruyol> call it X
<RX14> lol
<RX14> we should do that for april fools
<RX14> just "release" crystal X because semver is overrated
<FromGitter> <sdogruyol> haha that'd be great, I prefer Crystal 9000 though
<FromGitter> <sdogruyol> :D
<RX14> well
<RX14> jruby already did that
<FromGitter> <sdogruyol> yep
<FromGitter> <sdogruyol> I kinda liked it
<FromGitter> <sdogruyol> "Crystal X" sounds really badass, like an oscar award winning movie
<oprypin> RX14, so what is wrong with 0.24.0
<RX14> largely the omnibus
<FromGitter> <sdogruyol> libgc?
<RX14> no the LLVM assertion issue
<oprypin> but nothing wrong with the source code though?
<RX14> not...really
<oprypin> shouldn't that be written in the release page rather a generic message that could be said for every release
<RX14> i think there's some regressions
<RX14> oprypin, probably
<FromGitter> <sdogruyol> have we fixed --no-debug yet?
<RX14> i think it'd be best to discuss with @mgarciaisaia
<RX14> @sdogruyol no
<RX14> and nobody seems to be able to do it with the existing omnibus architecture
<RX14> I think I should be able to do it using my docker-build static-compiled omnibus
<FromGitter> <sdogruyol> what're we waiting for
<RX14> ideas
<RX14> and I have one its just not quite working
<RX14> lol rust's arch package size is 71.5MiB
<RX14> crystal's is 3.5
<FromGitter> <sdogruyol> 1) 3?
<FromGitter> <sdogruyol> that's what I see
<RX14> what?
<RX14> it's a 3.5MiB download
<RX14> 68MiB unpacked
<RX14> rust is over 250MiB unpacked
<FromGitter> <sdogruyol> now that makes sense
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
gcds has joined #crystal-lang
dostoyevsky has quit [Ping timeout: 248 seconds]
livcd has quit [Remote host closed the connection]
Papierkorb_ has quit [Quit: Konversation terminated!]
rohitpaulk has joined #crystal-lang
dostoyevsky has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
mark_66 has quit [Remote host closed the connection]
faustinoaq has quit [Quit: Konversation terminated!]
faustinoaq has joined #crystal-lang
rohitpaulk has joined #crystal-lang
faustinoaq has quit [Quit: Konversation terminated!]
faustinoaq has joined #crystal-lang
<travis-ci> crystal-lang/crystal#282834e (master - spec/methods: Fix typo in the comment): The build passed.
ryan_ has quit [Quit: Page closed]
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
hightower3 has joined #crystal-lang
claudiuinberlin has quit [Quit: Textual IRC Client:]
faustinoaq has quit [Quit: Konversation terminated!]
faustinoaq has joined #crystal-lang
hightower4 has quit [Ping timeout: 250 seconds]
faustinoaq has quit [Client Quit]
faustinoaq has joined #crystal-lang
vivus has joined #crystal-lang
alex`` has quit [Quit: WeeChat 1.9.1]
<FromGitter> <Rinkana> RX14, in a few lines can you explain what the omnibus is/does?
alex`` has joined #crystal-lang
waveprop has quit [Ping timeout: 248 seconds]
<oprypin> ‎@Rinkana‎, basically makes the Downloads you see at
<FromGitter> <ylluminate> not sure of the details yet, but wanted to give a heads up. apparently @fridgerator working with #amber discovered a problem with websockets and crystal's memory handling. it apparently leads to some serious performance issues and is very frustrating.
<Papierkorb> Rinkana, an "omnibus" in software is basically the embedded bundling of multiple programs, sometimes into a single one.
<FromGitter> <Rinkana> Ah i see.
faustinoaq has quit [Quit: Konversation terminated!]
faustinoaq has joined #crystal-lang
faustinoaq has quit [Quit: Konversation terminated!]
rohitpaulk has quit [Ping timeout: 258 seconds]
faustinoaq has joined #crystal-lang
faustinoaq has quit [Quit: Konversation terminated!]
faustinoaq has joined #crystal-lang
faustinoaq has joined #crystal-lang
faustinoaq has quit [Quit: Konversation terminated!]
gcds has quit [Ping timeout: 264 seconds]
<FromGitter> <marksiemers> Regarding the TechEmpower benchmarks and crystal's relatively slow db benchmarks. I tried creating both prepared statements and functions directly in postgresql (PG Admin actually). ⏎ In that environment, it made no difference - I think the queries are too simple, having the query plan cached doesn't gain anything. ⏎ It is possible that the pgAdmin overhead made the results misleading. Anyone have any
<FromGitter> ... knowledge of that happening?
faustinoaq has quit [Quit: Konversation terminated!]
faustinoaq has joined #crystal-lang
faustinoaq has quit [Client Quit]
faustinoaq has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
faustinoaq has quit [Quit: Konversation terminated!]
faustinoaq has joined #crystal-lang
faustinoaq has quit [Client Quit]
faustinoaq has joined #crystal-lang
faustinoaq has quit [Client Quit]
faustinoaq has joined #crystal-lang
sz0 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 250 seconds]
faustinoaq has quit [Quit: Konversation terminated!]
faustinoaq has joined #crystal-lang
<RX14> @marksiemers we should do what the top frameworks are doing, are they using prepared queries?
<RX14> I also don't think that crystal-db supports prepared queries
<Papierkorb> Never understood why prepared statements isn't more popular
<RX14> because they move the queries away from the code and they take effort and the performance gain is pretty small.
<RX14> postgres already keeps a cache of query -> plan iirc
<RX14> all it saves is the bytes overhead
<Papierkorb> The parsing overhead
<RX14> and that
<Papierkorb> And it's by default safe from injection attacks
<RX14> actually probably not
<RX14> Papierkorb, uhh we have that anyway
<RX14> with $1
<Papierkorb> Yeah no, the driver then escapes the data
<RX14> nooo
<RX14> it's all binary
<RX14> postgres recieves the query with $1 intact
<RX14> and applies the arguments itself
<Papierkorb> mh ok
<RX14> the postgres prepared query syntax literally uses $1, etc
<RX14> thats why the $1 and ? syntax is different between postgres and mysql Papierkorb
<RX14> because it's specified by the DB engine
<RX14> Papierkorb, also postgres could avoid parsing by storing just string -> plan
<FromGitter> <Sevensidedmarble> can I make macros at runtime by passing strings from something else into them?
<FromGitter> <Sevensidedmarble> or do they have to be AST node types?
<Papierkorb> >> "ß"[1].inspect
<DeBot_> Papierkorb: # => "'\\u{0}'" -
<Papierkorb> Not only broken for me, yay
<FromGitter> <Rinkana> Welp, that's not good
<Papierkorb> Will have a look
<RX14> wait what happened there??
<Papierkorb> UTF-8 is broken, yo
<Papierkorb> But yeah, taking a look at it now
<RX14> it got broken somewhere after 0.20.0
<RX14> somewhere between 0.20.5 and 0.21.0
<RX14> you can bisect quite easilly
<RX14> just a short bin/crystal eval and check the exit code as the bisection script
<FromGitter> <Rinkana> @Sevensidedmarble do you have an example of what you want to do?
<FromGitter> <Sevensidedmarble> so if I have a macro like this:
<FromGitter> <Sevensidedmarble> ```code paste, see link``` []
<FromGitter> <nicck> Hi everyone. Is there analog of 'mail' ruby gem in crystal world? I'm mostly interested in .eml parsing. Can't find anything on or awesome crystal-list. Where else can I check?
<FromGitter> <Sevensidedmarble> and say a test.txt file like this: ⏎ ⏎ `````` []
<FromGitter> <Sevensidedmarble> ```puts "test"```
<FromGitter> <Rinkana> Ah
<FromGitter> <Rinkana> I see what you want to do
<FromGitter> <Sevensidedmarble> can I load that string from an external file at runtime and make a macro from it?
<FromGitter> <Rinkana> But no you cant
<FromGitter> <Rinkana> What you can do is include the file
<FromGitter> <Rinkana> And define the content there as a constant
<FromGitter> <Sevensidedmarble> hmm
<FromGitter> <Rinkana> like `` ⏎ ⏎ ```TEST_CONTENT = "p \"test\""``` []
<FromGitter> <Sevensidedmarble> the context of this is I'm trying to come up with a way to include user defined functions in a shell
<FromGitter> <Sevensidedmarble> but I want the user to be able to write their 'shell scripts' just with valid crystal
<FromGitter> <Rinkana> But, macro's are compile-time. That would mean custom shell scripts like those would require the user to comple the program again
<FromGitter> <Sevensidedmarble> if I put them in a separate module though, only that could be compiled to save time though right?
<FromGitter> <Rinkana> I don't think you can do partial compiles now (at least not yet). But i'm not sure on that one.
<FromGitter> <Sevensidedmarble> I guess theres no getting around having to recompile everything then
<FromGitter> <Sevensidedmarble> I suppose its not a huge burden on the user
<FromGitter> <Sevensidedmarble> unless theres anything I'm overlooking
<FromGitter> <Rinkana> Well
<FromGitter> <Sevensidedmarble> I don't wanna write a complex interpreter
<FromGitter> <Rinkana> You could embed a scripting language like LUA
<FromGitter> <Rinkana> And use that for the scripts
<oprypin> Papierkorb, but "ß"[1] is out of bounds, thankfully the only error is that it doesnt throw an exception and it's an extremely rare situation
<FromGitter> <Sevensidedmarble> that could be an option, but I really wanted the user to be able to write shell scripts in crystal
<Papierkorb> It's so rare that my shards specs caught it oprypin
<RX14> but it broke in 0.21.0 lol
<RX14> its an ooold bug
<Papierkorb> Yeah I wrote this code .. in May or something?
<RX14> amazing nobody caught it
<Papierkorb> It was broken, and I was in a train and tired, and haven't checked since why lul
<RX14> 0.21.0 is like a year old
<RX14> oh
<RX14> only feb
<RX14> nvm
<FromGitter> <Rinkana> Thats almost a year already :P
<RX14> give or talk you know
<RX14> 4 months
alex`` has quit [Ping timeout: 250 seconds]
<RX14> which is a large portion of a year
<Papierkorb> oh shit
<RX14> Papierkorb, the question is if ßßßßß means you can go out of bounds by more than 1
<RX14> and get a segf
<RX14> >> "ßßßß"[8]
<DeBot_> RX14: 0x0: ??? at ?? -
<RX14> rip
<Papierkorb> I guess the error is in Char::Reader
<Papierkorb> which doesn't check OOB aparrently
<oprypin> RX14, no that's just Index out of bounds
<Papierkorb> > byte_index = char_index_to_byte_index(index)
<RX14> hence the rip
<Papierkorb> the following if doesn't do OOB check, and just asks the reader to do something
<RX14> I dislike Char::Reader overall
<RX14> it seems weird
<RX14> a more iterator-line interface with next and nil would be much better I think
<oprypin> ...until you actually try to implement it
<FromGitter> <Rinkana> @Sevensidedmarble with an language like LUA you can do practically the same. And they can be re-compiled in runtime. It's much easier for the user (and faster). And keeps you in control of what the user can and cannot do. You woulden't want users to embed their own code into the core code. They might break the thing in weird ways. And are huge securtity holes.
<RX14> why oprypin
<Papierkorb> >>"", 1).current_char
<DeBot_> Papierkorb: # => '\u{0}' -
<Papierkorb> Lovely
<RX14> exactly
<FromGitter> <Sevensidedmarble> It is a shell though, they are free to break it if the desire
<Papierkorb> >>"", 100).current_char
<DeBot_> Papierkorb: # => 's' -
<RX14> its easy to mess up
<Papierkorb> Ok so Char::Reader is basically MemoryRandom
<oprypin> Papierkorb, it doesnt do an out of bounds check for performance
<oprypin> or something..
<FromGitter> <Sevensidedmarble> I think if the user functions got compiled to their own crystal binary I could just pipe input to and from them
<Papierkorb> FML™
<FromGitter> <Sevensidedmarble> And that would save from recompiling the entire shell
greengriminal has joined #crystal-lang
<RX14> if its unsafe then it should be :nodoc:
<RX14> or named unsafe
<RX14> as i said
<Papierkorb> It it's unsafe then it should not be in the stdlib, there's no reason for it to not do bound checks
<RX14> Char::Reader suuucks
<RX14> there should be next and current
<RX14> and next should be Char?
<Papierkorb> So that should fix it
<FromGitter> <Rinkana> Then you'd have a huge package. As you need to include a whole crystal version just so you can compile on the fly.
<FromGitter> <Sevensidedmarble> Yeah that's one huge problem
<Papierkorb> Erm.. A *ton* of things rely on it..?
<FromGitter> <Sevensidedmarble> I don't really way users to have to have crystal
<FromGitter> <asterite> 1) Char::Reader is missing a check on pos in its constructor
<FromGitter> <asterite> 1) String#[] is missing an out of bounds check
<FromGitter> <asterite> That's all :-)
<Papierkorb> That alone wouldn't be so bad by itself
<FromGitter> <asterite> (and the fact that I meant "2" in the second line)
<RX14> @asterite yeah i agree that that fixes the bug but I think Char::Reader should be redesigned too
<FromGitter> <Sevensidedmarble> But I don't believe the world needs another bash/zsh/fish style interpreter
<Papierkorb> If Char::Reader#byte_at would not use String#unsafe_byte_at but String#byte_at - But when I replace it with that, almost 70 specs fail
<FromGitter> <asterite> Yes, Char::Reader is ugly
<FromGitter> <asterite> Feel free to redesign it :)
<FromGitter> <Rinkana> And what about just calling exec?
<FromGitter> <Sevensidedmarble> Then have people script in bash?
<oprypin> RX14, btw this is pretty dope :p
<RX14> what client is that oprypin
<RX14> did you write a script to parse FromGitter?
<FromGitter> <Rinkana> Yeah but I mean like this: `script = "../"` `system("sh #{script} #) `
<RX14> well
<Papierkorb> That's looks .. kinda crude
<RX14> at least hexchat is scriptable
<RX14> so you dont need to patch into C
<RX14> lol
<FromGitter> <Sevensidedmarble> there's the link @Rinkana
<FromGitter> <Rinkana> I'm sorry for the formatting I'm on mobile
<Papierkorb> QRegExp doesn't use the new shiny regex engine :(
<FromGitter> <Sevensidedmarble> I thought about just offering a sort of wrapper around bash like that
<Papierkorb> That'd be the totally obvious QRegularExpression
<Papierkorb> (Man fuck Qt4 compat in Qt5)
<RX14> haha
<FromGitter> <Sevensidedmarble> But I think it'd be really cool to do shell script style stuff in crystal
<oprypin> Papierkorb, hey man, the code follows code conventions in that file. that's the most important thing
<Papierkorb> oprypin: You could save so many CPU cycles though! All three of them!
<Papierkorb> well Konversation has been ported from Qt4, so..
<FromGitter> <marksiemers> @RX14 - I looked at fasthttp in Go - it looks like for both mysql and postgres they use prepared statements, though I can't tell for sure if that is a db prepared statement, or one for the db drivers: ⏎ postgres: ⏎ mysql:
<FromGitter> ... ksiemers/FrameworkBenchmarks/blob/master/frameworks/Go/fasthttp/src/server-mysql/server.go#L151
<RX14> no thats prepared statements
<FromGitter> <marksiemers> Testing in pgAdmin I saw no performance gain, but maybe when connecting from an app it helps...
<FromGitter> <Rinkana> @Sevensidedmarble yeah but it's kinda hard without re compiling your app. But if you don't mind I'll look at your app tomorrow and if I have an idea I will make an issue for it. But for now it's getting late here.
<FromGitter> <marksiemers> Even without support in crystal-db, I think you could do `APPDB.exec("PREPARE selectRandomNumber(id INT) ...") ⏎ Then `APPDB.exec("EXECUTE selectRandomNumber(5647);")` - but maybe there wouldn't be a performance gain.
<FromGitter> <Sevensidedmarble> That'd be awesome @Rinkana
<FromGitter> <Sevensidedmarble> I'm open to any commits or ideas
<FromGitter> <Sevensidedmarble> If anyone else had any ideas I'd love to hear them too
<FromGitter> <Sevensidedmarble> What I have so far is on that gh link
<Papierkorb> in retrospect, I shouldn't have said anything about this bug publicly. looks like a security vuln to me.
<FromGitter> <unreadable> One thing that makes fasthttp too is working entirely with byte array oO
<FromGitter> <unreadable> Wouldn't this be a plus for Crystal too?
<oprypin> Papierkorb, i dont see any way to do anything wrong with it other than reading a '\u{0}'
<Papierkorb> oprypin: Ah well, the cats outta the bag, you should see it in the PR
<oprypin> ?
<Papierkorb> My bad. This is actually kinda bad if you know what you're doing :)
greengriminal has quit [Quit: Leaving]
<Papierkorb> There you go
<oprypin> Papierkorb, i still dont see any security implications
<Papierkorb> It shouldn't be too bad as far String is concerned. thought at first I could get it to do up to 3 bytes OOB, but nah
<oprypin> yeah apparently you can't, i tried with a kanji or something
<Papierkorb> I guess that no-one used Char::Reader on their own anyway
waveprop has joined #crystal-lang
waveprop is now known as Guest7694
Guest7694 has quit [Changing host]
Guest7694 has joined #crystal-lang
Guest7694 is now known as waveprop
<FromGitter> <coderhs> any preferred way to exit a program with a message instead of raise?
<FromGitter> <coderhs> I want a command line application to exit with a message if it see a particular condition.
<FromGitter> <coderhs> is there any method for that. Right now I am using an if condition and puts.
<FromGitter> <coderhs> wanted to know if there was something like `exit` or `halt`
faustinoaq has quit [Quit: Konversation terminated!]
faustinoaq has joined #crystal-lang
<robacarp> @coderhs: puts "message" ; exit ?
<oprypin> coderhs,
waveprop has quit [Quit: leaving]
faustinoaq has quit [Quit: Konversation terminated!]
faustinoaq has joined #crystal-lang
Fraggle has joined #crystal-lang