RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
snsei has joined #crystal-lang
alex`` has quit [Ping timeout: 265 seconds]
snsei has quit [Ping timeout: 246 seconds]
Totoro has joined #crystal-lang
<crystal-gh> [crystal] Sija opened pull request #5618: Add additional parameters for Logger#new (master...logger-new-with-named-args) https://git.io/vNguy
<crystal-gh> [crystal] RX14 opened pull request #5619: Add Int#bits_set? method (master...feature/bits_set) https://git.io/vNgz5
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 265 seconds]
illyohs has quit [Remote host closed the connection]
illyohs has joined #crystal-lang
<FromGitter> <Dillybob1992> is it possible to add something to the array that db.query_all returns? for example ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ im trying to add another named tuple to it but it won't let me [https://gitter.im/crystal-lang/crystal?at=5a63e9275ade18be39a0e793]
qard has joined #crystal-lang
qard has quit [Quit: qard]
hightower4 has quit [Ping timeout: 248 seconds]
<FromGitter> <j8r> you can also try with a Hash
<FromGitter> <j8r> ... not sure. Anyway the problem isn't here
<FromGitter> <j8r> If I'm corret a Named Tuple is immutable, you can't change it's length
<FromGitter> <Dillybob1992> Where would the problem be?
vivus has quit [Quit: Leaving]
snsei has joined #crystal-lang
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jnyw has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
snsei has joined #crystal-lang
<FromGitter> <Dillybob1992> something like this maybe? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a64061cae53c1590313e536]
<crystal-gh> [crystal] wmoxam closed pull request #4770: Refactor platform specific process path (master...refactor-platform-specific-process-path) https://git.io/v7Boc
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vNgr0
<crystal-gh> crystal/master e83e894 Sijawusz Pur Rahnama: Add additional parameters for Logger#new
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
snsei has joined #crystal-lang
<crystal-gh> [crystal] wmoxam closed pull request #5414: [WIP] Force enable IPv6 on Travis (master...fix-ipv6-errors-on-travis) https://git.io/vb1sS
cremes has joined #crystal-lang
<travis-ci> crystal-lang/crystal#e83e894 (master - Add additional parameters for Logger#new): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/331369624
cremes has quit [Quit: cremes]
sz0 has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 265 seconds]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
qard has joined #crystal-lang
snsei has quit [Remote host closed the connection]
qard has quit [Quit: qard]
hightower4 has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter> <Dillybob1992> Okay, I finally got it! :D :D shows this (https://i.gyazo.com/2a7213be89b2cc896ddfe47fc274d8aa.png) ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a6443655a9ebe4f75b41391]
illyohs has quit [Quit: Leaving]
alex`` has joined #crystal-lang
snsei has joined #crystal-lang
hightower4 has quit [Ping timeout: 240 seconds]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
hightower4 has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 265 seconds]
alex`` has quit [Quit: WeeChat 1.9]
DTZUZU has quit [Ping timeout: 248 seconds]
jnyw has quit [Quit: WeeChat 2.0.1]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 265 seconds]
<FromGitter> <bararchy> If anyone is interested, SHAInet has just released version 2.0.0 with Convolutional neural network support. ⏎ https://github.com/NeuraLegion/shainet
<greenbigfrog> morning. Not sure if I'm blind, but where can I specify how BigDecimal rounds?
<greenbigfrog> nvm...
<greenbigfrog> it inherits round from Number...
<greenbigfrog> this has been fixed in master, right?
<RX14> yes
<greenbigfrog> argh... I guess I might have to use master now...
hightower3 has joined #crystal-lang
hightower2 has quit [Ping timeout: 255 seconds]
<FromGitter> <Dillybob1992> Which way uses less resources on server: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a647e00ba39a53f1a41a1da]
<shelvacu> The second one
<FromGitter> <Dillybob1992> that was fast, ty :)
<Groogy> Morning o/
<FromGitter> <Dillybob1992> Morning o/
<FromGitter> <asterite> What? No, the first one
snsei has joined #crystal-lang
<FromGitter> <asterite> It's easy, you can benchmark it
<FromGitter> <Dillybob1992> Really lol
<FromGitter> <Dillybob1992> Well, crap just started editing mah code. @shelvacu you see?
<FromGitter> <asterite> Yes, there's no reason the second one should be faster. It deals with unions. The first one will parse directly to a string, no unions involved
<FromGitter> <asterite> You should always ask for a reason :-P
<FromGitter> <asterite> Plus the first one is type safe
<FromGitter> <Dillybob1992> @asterite Yeah, I asked u about that question last week or so, had to scroll all the way up to find out your message. Took me literally 10 minutes cause gitter's search sucks.
<FromGitter> <Dillybob1992> Well, ima use Hash(String, String) then for now :D
<Groogy> there is a whole benchmark module built in to the standard lib
<Groogy> you should check it out, it's quite helpful and easy to use
snsei has quit [Ping timeout: 246 seconds]
<crystal-gh> [crystal] Sija opened pull request #5620: Allow leading and trailing whitespace in number strings (master...allow-surrounding-spaces-in-number-strings) https://git.io/vNgdV
<greenbigfrog> somehow running the specs crashes my old shitty laptop I run crystal on
dragonkh has joined #crystal-lang
dragonkh has quit [Client Quit]
<FromGitter> <asterite> That's the real power of Crystal
<FromGitter> <bararchy> XD
<RX14> only heard of that happening on WSL greenbigfrog
<greenbigfrog> interesting. it's a dell latitude d830
<greenbigfrog> I guess I'll have to port crystal-pg to use BigDecimal...
<FromGitter> <Dillybob1992> so, i go here https://crystal-lang.org/docs/guides/performance.html and do the benchmark part but replace the code inside the block with what i want to do?
<FromGitter> <Dillybob1992> aww i see, thx
<FromGitter> <Dillybob1992> ```code paste, see link``` ⏎ ⏎ gives me `undefined method 'from_json' for Hash(String, String):Class` [https://gitter.im/crystal-lang/crystal?at=5a64896eae53c1590315cc8a]
<FromGitter> <Dillybob1992> i forgot require "json" LMAO WOW
<FromGitter> <Dillybob1992> Okay, got "official" benchmarks, did I do it right?
<greenbigfrog> I'd say you've got a clear result there
<FromGitter> <Dillybob1992> So wait, the first one is faster then?
<FromGitter> <Dillybob1992> But is this premature optimization?
<RX14> @Dillybob1992 Please use Benchmark.ips
<RX14> Benchmark.measure only runs the test once
<RX14> you won't get very reliable results
<RX14> Benchmar.ips does a lot more thorough testing and gives you a lot more information
<FromGitter> <Dillybob1992> @RX14 done :D looks like json.parse it is!
<RX14> i would have thought it would be the other way around myself
<RX14> thats interesting
<greenbigfrog> https://github.com/will/crystal-pg/blob/master/spec/pq/authentication_methods_spec.cr#L4 I'm confused by this line. What exactly am I supposed to add?
<FromGitter> <Dillybob1992> im just really bored that's why im testing ahhaa i doubt it'll affect my game server but maybe...
<RX14> @Dillybob1992 I'd still use the former
<RX14> it's easier to use the result
<FromGitter> <Dillybob1992> yeah i was gonna say, i don't have to write "as_s" all over
<FromGitter> <Dillybob1992> im on windows on bash that might have an effect to this benchmark too possibly?
<RX14> i'm not sure
<FromGitter> <Dillybob1992> that benchmark thing is freaking awesome though, ima be having fun with that, haha.
<RX14> don't have too much fun hahaha
<FromGitter> <Dillybob1992> :D :D
<FromGitter> <bararchy> This is cool !
<FromGitter> <bararchy> Groogy, 6k FPS? lol omg
<Groogy> that's in debug though
<FromGitter> <bararchy> XD
<RX14> well it *is* a rather basic scene
<Groogy> Yeah removed the UI rendering which renders to an off-screen render target so less driver calls there, etc.
<Groogy> there you go running in release
<FromGitter> <Dillybob1992> dat fps
<Groogy> compared to Ruby, this is very fast
snsei has joined #crystal-lang
<RX14> not surprised
<RX14> even the lower-overhead C FFI than ruby would provide a big boost i suspect
<FromGitter> <Dillybob1992> is that opengl 3.0?
<Groogy> That's opengl 4.6
<FromGitter> <Dillybob1992> o
<Groogy> Yeah, from what I remember last time I did Ruby and 3D was just the fact looping over objects was insanely expensive for Ruby to do
<FromGitter> <Dillybob1992> engine i use (godot) use 3.0, i thought that was latest.. lol
<Groogy> Godot has crystal bindings?
<FromGitter> <Dillybob1992> i wish
<Groogy> also I think Godot actually run on OpenGL ES 2.0
<Groogy> though equivalent would be OpenGL 3
snsei has quit [Ping timeout: 265 seconds]
<FromGitter> <Dillybob1992> there is a nasty opengl bug on windows only, on nvidia cards. where the initialize of opengl delay scales linearly to the amount of opened instances u have. pretty funny/sad. i reported it
<FromGitter> <bararchy> I keep getting malformed responses from servers with HTTP::Client, the thing is it's really hard to create a small example :\
<FromGitter> <bararchy> ok, getting there ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ This will produce an out-of-bound error [https://gitter.im/crystal-lang/crystal?at=5a6493b95ade18be39a37013]
<FromGitter> <bararchy> not sure why
<FromGitter> <l3kn> Are newlines allowed in urls?
<FromGitter> <l3kn> https://www.w3schools.com/tags/ref_urlencode.asp doesn't mention it, but I guess `%0A` instead of `\n`would be the way to go
<FromGitter> <bararchy> I guess crystal HTTP::Client wont encode the \n to %0A, so this might be a bug in the URI class
<FromGitter> <bararchy> though there are two issues here, one, HTTP::Client should not get index error, and two, the URI encoding is not working for newline
<FromGitter> <bararchy> though, it seems that the issue is a little dipper, testing against other sites will not generate the exception, which means the issue is in the response from the server ?
<greenbigfrog> How can I read a BigDecimal in a JSON mapping?
<FromGitter> <l3kn> @bararchy From a quick look, it seems like https://github.com/crystal-lang/crystal/blob/18e76172444c7bd07f58bf360bc21981b667668d/src/uri.cr#L262 only escapes spaces and non-ascii characters
<FromGitter> <l3kn> In ruby there is a list of allowed chars (A-z0-9$_ etc) and everything else will be escaped
<FromGitter> <l3kn> but you are right, that is not the main issue in your case
<greenbigfrog> `no overload matches 'BigDecimal.new' with type JSON::PullParser`.... wtf... this has been merged into master and I'm quite sure I'm using master compiler
<FromGitter> <bararchy> @l3kn we might need to change the escape logic to work on a white list instead of black list, this is better to handle end cases like this
<FromGitter> <bararchy> @l3kn seems like URI.escape does handle `\n`
<FromGitter> <bararchy> > puts URI.escape("\n")
<FromGitter> <bararchy> > puts URI.escape("\n")
<FromGitter> <bararchy> damn
<FromGitter> <bararchy> how do I cann the crystal bot ?
<FromGitter> <l3kn> Oh, I was looking at the wrong `escape` function
<FromGitter> <l3kn> Forget what I said, the function above that works just like the ruby version
<FromGitter> <bararchy> yeha, figured :) ⏎ So still there is an issue with the wierd OOB error
<RX14> the crystal spec suite needs to define *one* data directory and *one* temporary directory (which can be overridden when cross-compiling) and specs need to use them
<RX14> because the state of cross-compiling the spec suite is just terrible
snsei has joined #crystal-lang
<RX14> I've just checked out the crystal git repo in C:\data\programming\...\feature\windows-spec on my windows VM
<RX14> because there's no other way to do it
<RX14> oh, and windows's suggested tempdir isn't writiable! or something
<RX14> you can create files in that directory but not delete them
<RX14> it sucks
<greenbigfrog> https://gist.github.com/greenbigfrog/3deadbfafa099cd6521e0de4851dd2d5 shouldn't this work with master compiler?
<greenbigfrog> still getting `no overload matches 'BigDecimal.new' with type JSON::PullParser`
<FromGitter> <bararchy> RX14 what tempdir does win uses? c:\temp ? or c:\tmp ?
<RX14> neither lol
<RX14> it's per-user
<RX14> in the appdata folder
<FromGitter> <bararchy> Oh, makes sense
<FromGitter> <l3kn> @bararchy If there are newlines in the url, "<html>" gets passed to to Response.from_io, instead of something like `HTTP/1.1 404 Not Found`
<FromGitter> <Dillybob1992> hmm. how would you parse this `Hash(String, String).from_json(%({"cmd":"LOGIN","message":{"password":"test","username":"TestUser92"}}))` since the message is another json part. Is this possible with a Hash defined literal, or would I need to make a class that uses json mapping?
<FromGitter> <l3kn> I'll see if I can find out why that happens
<RX14> File spec suite works
<RX14> but Dir spec suite is just broke
snsei has quit [Ping timeout: 276 seconds]
<FromGitter> <Dillybob1992> could something like this work? `Hash(String, String | Hash(String, String))`
<RX14> mostly the glob tests because the specs expect unix paths
<RX14> and you don't get unix paths
<RX14> you get windows paths
<RX14> which is why we need Path class so much
<RX14> everything is broken
<greenbigfrog> rx, you have any idea why I'm getting that missing overload error?
<RX14> yes
<RX14> Think you have to require an additional file
<RX14> Read the pr
<greenbigfrog> yep...
<greenbigfrog> thanks
<greenbigfrog> somehow I missed that it was in `big/json`...
tweaks has quit [Quit: leaving]
<oprypin> RX14, i changed the appearence of user flair on reddit, check it here https://reddit.com/r/crystal_programming/comments/7o68nn/
<FromGitter> <l3kn> @bararchy I think I know what the problem is, can you take a quick look in case I am overlooking something again?
<FromGitter> <l3kn> https://github.com/crystal-lang/crystal/blob/master/src/http/request.cr#L40 uses `@uri` to access the uri, but it is `nil`, so the plain resource is used
<FromGitter> <bararchy> @l3kn interesting , and in that moment the \n issue happen
<FromGitter> <l3kn> Maybe that is not so bad by itself, but this way URI.escape is never called and invalid chars make it into the http request
<FromGitter> <l3kn> https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.2 says the stuff in the request should conform to the uri standard, and there (https://www.ietf.org/rfc/rfc2396.txt) newlines are counted as control characters and excluded
<greenbigfrog> https://carc.in/#/r/3f9u how come line 4 puts here, even though it's nil?
<FromGitter> <l3kn> Not sure what the correct behavior would be, fail when parsing the URI or use escaped paths in the request
<FromGitter> <l3kn> greenbigfrog: Because it is a `JSON::Any` wrapped around `nil`, if you print it, the print it, it prints the value of the raw element (nil)
<greenbigfrog> hm. ok. makes kinda sense. how would I check if it's nil though correctly?
<FromGitter> <l3kn> https://carc.in/#/r/3fa6 that works, probably not the most most elegant solution though
<greenbigfrog> ok
<FromGitter> <l3kn> Alternatively, you could create a `Result` class with a nilable `error` property and work with that
DTZUZU has joined #crystal-lang
<greenbigfrog> ok
<greenbigfrog> thanks
<greenbigfrog> and sorry for bothering you all the time
<greenbigfrog> anyone able to point me towards on where I would start to implement BigDecimal into crystal-pg
cremes has joined #crystal-lang
<RX14> dir_spec and file_spec are now working
<FromGitter> <l3kn> greenbigfrog: I guess splitting the digits array at the location of the decimal point and converting both halves into BigInts would be all you need to do
<greenbigfrog> will take a look. thanks
<RX14> I'm pretty sure that sshing into my windows VM is actually noticeably slower than before due to meltdown patches
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vN2Jr
<crystal-gh> crystal/master e5da7d3 Chris Hobbs: Add Int#bits_set? method (#5619)
<crystal-gh> [crystal] S-YOU closed pull request #5616: Use slice instead of StaticArray for String::CHAR_TO_DIGIT (master...chore_char_to_digit) https://git.io/vNgmr
<crystal-gh> [crystal] RX14 opened pull request #5622: Correctly stub out Exception#backtrace? (master...feature/windows-backtrace-stub) https://git.io/vN2Jp
<FromGitter> <bararchy> RX14 is the VM local ?
<RX14> yeah
<FromGitter> <bararchy> Are you using VMware ?
<RX14> no lol
<RX14> kvm like god intended
<FromGitter> <bararchy> QEMU ?
<FromGitter> <bararchy> Cool
<RX14> god being RMS of course
<FromGitter> <bararchy> I also use KVM , didn't notice any slow downs , on VMware and ESX , its slow as hell , actually 30%
<RX14> it's not actually much slower using it
<RX14> it's slower sshing into it
<RX14> most of the time is spent in sshd forking a new process and doing all the syscalls to make it a user session I think
<RX14> i mean, if you're using linux there's pretty much no point using anything else but kvm
<RX14> it's so good
<RX14> and you have virt-manager which makes setting it up really easy
<crystal-gh> [crystal] RX14 opened pull request #5623: Implement File and Dir for win32 (master...feature/windows-file-dir) https://git.io/vN2Ua
<greenbigfrog> I've got https://github.com/greenbigfrog/crystal-pg/blob/bigdecimal/src/pg_ext/big_decimal.cr so far. How come I'm still getting `PG::ResultSet#read returned a PG::Numeric. A BigDecimal was expected. (Exception)` if I do `@db.query_one("SELECT * FROM sth", &.read(BigDecimal))`
Ven`` has joined #crystal-lang
<travis-ci> crystal-lang/crystal#e5da7d3 (master - Add Int#bits_set? method (#5619)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/331491654
<DeBot> https://github.com/crystal-lang/crystal/pull/5619 (Add Int#bits_set? method)
<FromGitter> <l3kn> greenbigfrog: Did you require "pg_ext/big_decimal" in your test code?
<FromGitter> <bararchy> Oh, RX14 try configuring a DNS , in the Ubuntu shell , I had lots of times that using Ubuntu boxes without DNS configured it will query for ptr until timeout , and only then will it start the session
<greenbigfrog> oops...
<RX14> @bararchy dns works fine...
<greenbigfrog> getting https://hastebin.com/xijopacowu.scala though
<RX14> plus it's the difference between 500ms and 2s that i'm complaining about
<RX14> not if that much
<FromGitter> <bararchy> Oh, so no 360s timeout
<FromGitter> <bararchy> Cool
<greenbigfrog> do I have to set full path when I require part of a shard that I'm using via path?
<FromGitter> <bararchy> Got you
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RX14> lol yeah
Ven`` has joined #crystal-lang
<RX14> it's the difference between 10 mins to generate windows_spec.cr and 22 mins to generate windows_spec.cr
Groogy has quit [Quit: WeeChat 2.0.1]
<FromGitter> <l3kn> greenbigfrog: How did you require "pg"?
Tobi_ has joined #crystal-lang
<Tobi_> hello
<greenbigfrog> just `require "pg"` and in my shard.yml: https://hastebin.com/uvofayukun.coffeescript
<Tobi_> which Editor/IDE du you use for crystal? And does it support code completion?
<FromGitter> <l3kn> greenbigfrog: Maybe "pg/pg_ext/big_decimal"?
<FromGitter> <asterite> pg_ext seems to be in your code, use a relative path to require it
<greenbigfrog> yep. thanks
<FromGitter> <asterite> A non-relative path is only for std and shards
<FromGitter> <asterite> A relative path is for your code/shard
<greenbigfrog> any idea why the full path didn't work?
<RX14> because full paths don't work
<RX14> at all
<greenbigfrog> why's that?
<RX14> nobody's bothred to implement it?
<greenbigfrog> ok
snsei has joined #crystal-lang
<greenbigfrog> yay... got it working besides the .to_big_d part...
snsei has quit [Ping timeout: 276 seconds]
Tobi_ has quit [Quit: Page closed]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lvmbdv has quit [Quit: WeeChat 2.0.1]
lvmbdv has joined #crystal-lang
Ven`` has joined #crystal-lang
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alex`` has joined #crystal-lang
<greenbigfrog> argh... why is it so hard (more like badly explained) how to set up enviroment for the crystal-pg specs...
snsei has joined #crystal-lang
<greenbigfrog> can anyone confirm the specs at https://github.com/greenbigfrog/crystal-pg/tree/bigdecimal work?
snsei has quit [Ping timeout: 276 seconds]
<greenbigfrog> got them finally to work...
<greenbigfrog> anyone able to tell me why I get https://hastebin.com/kuxemopeda.hs when running the specs?
<FromGitter> <xfbs> What's the state of named arguments in crystal again?
<oprypin> xfbs, very good
illyohs has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 265 seconds]
emilsp has quit [Ping timeout: 612 seconds]
qard has joined #crystal-lang
cremes has quit [Quit: cremes]
cremes has joined #crystal-lang
<FromGitter> <j8r> I've opened an issue (https://github.com/crystal-lang/crystal/issues/5467). Where to begin to add a new architecture target for Crystal?
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 276 seconds]
* greenbigfrog just realized he might have been trying to reinvent the wheel along...
<hightower4> Hey, I see that calling HTTP::Request.headers["Some-Header"] returns a concated list of values, but internally it is an array. Is there a way to retrieve actual array content using the public API?
<oprypin> hightower4, i think #get method
<oprypin> the api looks terrible, i had to just scan through source code until i didn't see "concat" in one of them
<hightower4> That's the one, thanks oprypin!
ua has quit [Ping timeout: 256 seconds]
cremes has quit [Quit: cremes]
ua has joined #crystal-lang
brycek has joined #crystal-lang
<greenbigfrog> is there a way to rescue a rescue without putting one in the other?
<FromGitter> <xfbs> Wait if you're rescuing a rescue then I think you might be doing something odd or wrong?
<greenbigfrog> probably... I first need to turn a JSON::Any in a Hash(String, JSON::Any) and after that try to turn it into Array(JSON::Any)
cremes has joined #crystal-lang
alex`` has quit [Ping timeout: 256 seconds]
<greenbigfrog> Shouldn't a begin without a rescue also rescue but just not do anything?
<greenbigfrog> or apparently not...
<greenbigfrog> somehow that's what I had expected,,,
duane has joined #crystal-lang
pta2002 has joined #crystal-lang
<pta2002> hello, i'm trying to run `crystal spec` but it gives an error
<pta2002> Error: execution of command failed with code: 1: `cc "${@}" -o '/home/pta2002/.cache/crystal/crystal-run-spec.tmp' -rdynamic -lxml2 -lpcre -lm -lgc -lpthread /usr/share/crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/lib -L/usr/local/lib`
<oprypin> pta2002, what crystal version, what distribution
<pta2002> fedora
<pta2002> let me grab the version
<pta2002> 0.24.1
<pta2002> LLVM 4.0.0 target x86_64-unknown-linux-gnu
<pta2002> worth mentioning I didn't code anything yet
<pta2002> just whatever shows up when you run `crystal init app stuff`
<greenbigfrog> you need lxml2
<pta2002> lxml2?
<pta2002> I'll try
<greenbigfrog> fedora doesn't have a package so far I was able to tell
<oprypin> greenbigfrog, no way
<greenbigfrog> no way what?
<oprypin> greenbigfrog, and that's definitely not the right lxml
<greenbigfrog> oops. yeah that's the wrong page
<oprypin> and i don't see what makes you think it's xml
<greenbigfrog> because IIRC I had exactly that error a few days back and it was fixed after installing some package related to xml parsing
<oprypin> yeah seems likely. libxml2
<greenbigfrog> that's the package I meant...
<oprypin> but really, pta2002, i suspect there's more to that error that you're not showing
<pta2002> "/usr/bin/ld: cannot find -lxml2"
<pta2002> the lib is xml2 not lxml2
<pta2002> -l is the ld flag to link a library, so it's -l[name]
qard has quit [Quit: qard]
<pta2002> so i'll try installing libxml2 and libxml2-devel
<oprypin> pta2002, well yeah but you could have told us about that line of error.....
<pta2002> didn't notice
<pta2002> there we go that worked
snsei has joined #crystal-lang
<greenbigfrog> :+1:
snsei has quit [Ping timeout: 246 seconds]
cremes has quit [Quit: cremes]
Ven`` has joined #crystal-lang
<FromGitter> <xfbs> Umm is there a way that I can use a function that `yield`s as an Iterator? Like so: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a651842517037a212d71126]
<RX14> no
<FromGitter> <xfbs> So to be clear, the only way to write an iterator is ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a6519245a9ebe4f75b7e464]
<FromGitter> <xfbs> `s/each/next/g`
<oprypin> xfbs, probably
<oprypin> there's no opposition against this idea with `yield` but basically nobody knows how to implement it
<RX14> you have to do a bunch of AST transformations to make a state machine
<RX14> it's basically not something we want to work on
<RX14> it'll probablt get added some point in the future maybe
<FromGitter> <xfbs> I think I was just super confused because I'm in between languages right now and that's how you do it in python, so I was like, "wait wtf this worked yesterday"
<RX14> lol
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <xfbs> How do I cast a number to type T? Is that even possible?
<FromGitter> <xfbs> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a651d3e517037a212d729a6]
<RX14> T.new(num)
jnyw has joined #crystal-lang
<FromGitter> <jwaldrip> Working on an ORM. Wanted to get some feedback on the Model DSL. Any feedback. I am planning on using a sync paradigm over the typical migration paradigm. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a65222e5ade18be39a61307]
moei has quit [Quit: Leaving...]
<RX14> looks pretty good
<RX14> I'd suggest doing it by auto generating migrations based on the modified schema
<RX14> and the current schema
<FromGitter> <jwaldrip> Yes
<FromGitter> <jwaldrip> thats what I am planning
<RX14> so you "store" the sync
<RX14> yeah good
<FromGitter> <jwaldrip> similar to what typescripts typeorm does
<RX14> otherwise it'll get really broken really quick
<RX14> and at least that way you can create custom migrations
<RX14> and the option's always there
<FromGitter> <jwaldrip> Right, I still want the ability to create custom migrations
<FromGitter> <jwaldrip> but by default, be able to lean on the syncing of the models to the Db
<FromGitter> <jwaldrip> This would only require the knowledge of the model DSL to get an app up and running.
<FromGitter> <jwaldrip> My example was verbose to show the options, but many of those things are inferred.
<RX14> I assume your constraints are actually passed to the DB
<FromGitter> <jwaldrip> correct
<RX14> instead of not being enforced at the DB like activerecord
<RX14> because thats great
<FromGitter> <jwaldrip> anything in schema is in the db
<RX14> yay
<FromGitter> <jwaldrip> anything outside of schema is in the application
<FromGitter> <jwaldrip> But I am going lean on the db as much as I can and shy away from application validation wherever possible
<RX14> i presume that this ORM gets a bit macroey
<FromGitter> <jwaldrip> small macros... but yes
<RX14> nice that you managed to get small macros though
<RX14> i'll have to take a look
<FromGitter> <jwaldrip> Still working in prototype mode. Most of my macros are not over 10 lines
<FromGitter> <jwaldrip> Nothing is even close to working... but here is an example of the macros thus far: https://github.com/obsidian/orm/blob/master/src/orm/schema.cr
<RX14> i presume you know that macro field is broken
<RX14> because there's no {{}}
<RX14> this is awesome
<FromGitter> <jwaldrip> lol
<FromGitter> <jwaldrip> much of this is still just playing
<FromGitter> <jwaldrip> as I said, nothing working...
<RX14> i'm not sure how helpers work in orion though
<FromGitter> <jwaldrip> lol
<FromGitter> <jwaldrip> What do you mean?
<FromGitter> <jwaldrip> they DO work
<RX14> i'm looking at the docs and I don't get it
<FromGitter> <jwaldrip> When inherited from the base class a router gets a Helper module
<FromGitter> <jwaldrip> then as you define routes, things get added to that module if you pass the `helper: "name"` param
<RX14> i mean what their use is
<RX14> I don't get what they are
<FromGitter> <jwaldrip> Oh
<RX14> i'm looking at the docs and I just don't understand what they are or how they work
<FromGitter> <jwaldrip> I see. So its from rails
<FromGitter> <jwaldrip> So basically its a way to get a "named" http route throughout the application
<FromGitter> <jwaldrip> for example `Helpers.user_path(1)` would return `"/users/1"`
<FromGitter> <jwaldrip> Make sense?
<RX14> yeah
<FromGitter> <jwaldrip> It was a concept borrowed from rails.
<RX14> i think
<RX14> so what happens when you call user_path(1)?
<RX14> you get a URL?
<FromGitter> <jwaldrip> yes, you get a url
<FromGitter> <jwaldrip> ah sorry, you get a path
<FromGitter> <jwaldrip> if you call user_url(id: 1) you get a url.
<RX14> I think you need to doc them a bit better
<FromGitter> <jwaldrip> Good feedback. I will make it more clear.
<RX14> also the example is weird
<RX14> isn't scope users helper new defining the hlper as users_new?
<RX14> and then the example uses new_user_path?
<RX14> and why's there a MyControler not mentioned in the router, and a missing Users controller
<RX14> i'm talking this example: https://github.com/obsidian/orion#helpers
<RX14> "helper" to me is a weird name too
<RX14> "route helper" sure
<RX14> but just calling them helpers makes them sound too generic
<FromGitter> <jwaldrip> you mean in the readme?
<RX14> yep
<FromGitter> <jwaldrip> k
<RX14> also I don't quite like the implicit users -> userscontroller magic
<RX14> personally i'd much rather have
<RX14> get "/", to: UsersController.new
<RX14> and then it's actual crystal syntax
<RX14> and you can tab complete the type name
<RX14> and there's far less magic and thinking required to convert from the "to" to the actual location of the route
<RX14> although the .new syntax for calling an instance method is a bit weird
<RX14> also @jwaldrip, you should be able to replace all of http/request.cr with just `property(path_params : Hash(String, String)) { Hash(String, String).new }`
<RX14> or leave out the explicit type
<RX14> actually no because of the :nodoc:
<RX14> never mind
<RX14> it makes sense
<FromGitter> <jwaldrip> So the `to: ""` format is magical yes... but there are alternatives to the form you are looking for
<FromGitter> <jwaldrip> to: "" was the rails-esque part
<RX14> yeah
<FromGitter> <jwaldrip> then there is `controller: UsersController, action: show`
<RX14> yeah I guess
<RX14> I kinda prefer just to: "UsersController#show" instead of "Users#show" myself