ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.20.5 | Fund Crystal's development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
soveran has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 268 seconds]
pawnbox has joined #crystal-lang
akwiatkowski has quit [Ping timeout: 245 seconds]
<jokke> or expect(foo).to be > 5 with spec2
pawnbox has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has quit [Ping timeout: 260 seconds]
mcnobody_ has joined #crystal-lang
<mcnobody_> Hello, does anybody know if crystal play will work when not accessed via localhost? I have it running in a VM but can't access it via http://<ip address>:8080. I've disabled the firewall and tried different port numbers - still no go while other web servers will.
<FromGitter> <jots_twitter> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58a65dc8872fc8ce6247860c]
<mcnobody_> thanks, that did it. I didn't think to try the -b HOST option, my bad
squeaky_pl has quit [Remote host closed the connection]
squeaky_pl has joined #crystal-lang
danielpclark has quit [Quit: Leaving]
squeaky_pl has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
deepbook5broo has joined #crystal-lang
deepbook5broo has left #crystal-lang [#crystal-lang]
p0p0pr37 has quit [Read error: Connection reset by peer]
p0p0pr37 has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 255 seconds]
<crystal-gh> [crystal] karlseguin opened pull request #4045: Optimise Indexable#== (master...feature/indexable_equals_opt) https://git.io/vD9yv
pawnbox has joined #crystal-lang
mcnobody_ has quit [Quit: Page closed]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 268 seconds]
triangles has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
triangles has quit [Quit: Leaving]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
bjz has joined #crystal-lang
pawnbox has quit [Ping timeout: 255 seconds]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 240 seconds]
akwiatkowski has joined #crystal-lang
<FromGitter> <ezrast> What's the best way to determine operating system?
pawnbox has joined #crystal-lang
mark_66 has joined #crystal-lang
persand has joined #crystal-lang
<FromGitter> <mverzilli> `uname` with all the flags you can fit in :P
<FromGitter> <mverzilli> like `uname -amnprsv`
<FromGitter> <ezrast> but... `-a` implies all the others?
<FromGitter> <mverzilli> tru dat :)
<FromGitter> <ezrast> Actually all I care about is procfs so I guess I'll just check for the specific files I need
<FromGitter> <mverzilli> what are you up to?
<FromGitter> <mverzilli> (out of curiosity!)
<FromGitter> <ezrast> Working on https://gitlab.com/ezrast/crometheus/ ; need to get memory stats and open file handle counts and such to do some basic process instrumentation.
<FromGitter> <persand> I need to convert YAML files to JSON. What's the option here?
persand has left #crystal-lang [#crystal-lang]
crack08 has joined #crystal-lang
<FromGitter> <rishavs> i am very new to crystal but maybe you can map a yaml to an object and then create a json from that
<FromGitter> <rishavs> https://crystal-lang.org/api/0.20.5/YAML.html#mapping%28properties%2Cstrict%3Dfalse%29-macro
<FromGitter> <persand> @rishavs thanks but I’d like to avoid mapping as the YAML files are all different from each other.
<FromGitter> <rishavs> hmm. here is a gist of it being done in ruby. maybe you can just port it
<FromGitter> <rishavs> in general i find that whenever i hit any issue in crystal, i can google for comparable problems in ruby and the answer can be easily used in ruby
<FromGitter> <rishavs> in crystal *
<FromGitter> <rishavs> btw i have a generic question, can i use cr files tp keep config in? maybe use a class and the attributes become the key value pair of the config? I feel yaml, json etc shouldnt be required for simple configs. ⏎ ⏎ Is this an ok way to do things? specially if i am keeping stuff like password and such in the file?
<FromGitter> <persand> @rishavs I’ll keep digging
<FromGitter> <rishavs> @persand sorry, wasnt much help.
<FromGitter> <persand> Perhaps I could use git hooks and something like ` ruby -ryaml -rjson -e 'puts JSON.pretty_generate(YAML.load(ARGF))' < test.yml > test.json ` ⏎ ⏎ ¯\_(ツ)_/¯
<FromGitter> <ezrast> @rishavs Using Crystal for config is awkward since it's a compiled language. There's no way to `require` a file at run-time; your application would have to include the compiler or a subset of it.
<FromGitter> <rishavs> @ezrast ah, so if i make any config change, i will have to recompile the whole project?
<FromGitter> <ezrast> pretty much, yeah
soveran has joined #crystal-lang
gewo has quit [Ping timeout: 252 seconds]
inersha has joined #crystal-lang
gewo has joined #crystal-lang
<inersha> After I've used scan() on a string, how can I join the result back in to a string? For example, I'm trying this:
<inersha> puts "abcdefgh".scan(/../).join("")
<inersha> But I seem to only get a list of regex objects back?
<FromGitter> <ezrast> `"abcdefgh".scan(/../).map{ |m| m[0]}.join`
<inersha> FromGitter: Thank you!
<FromGitter> inersha, I'm a bot, *bleep, bloop*. I relay messages between here and https://gitter.im/crystal-lang/crystal
<FromGitter> <in3rsha> @ezrast Also, would you say that .scan(/../) is a good way to get every two characters from a string?
<FromGitter> <ezrast> Seems fine to me but I'm not an expert
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
squeaky_pl has joined #crystal-lang
<FromGitter> <crisward> @ezrast we use a json file for config, we parse the json when it needs to be read and read the values from their. Also for more secure config items ie, db connection, env variables can be read at runtime too.
inersha has left #crystal-lang [#crystal-lang]
<crystal-gh> [crystal] ysbaddaden opened pull request #4046: Fix: configurable SO_REUSEPORT socket setting (disabled by default) (master...fix-tcp-server-reuse-port) https://git.io/vDHTd
<FromGitter> <ezrast> @crisward The question was about storing config options in Crystal language format
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
soveran has quit []
<FromGitter> <rishavs> @crisward how are you handling the security of your db connection details? i have now gone for a simple yml file which contains plaintext password. the file wouldnt be checked into git for sure. But is there anything else i should do to make things more secure?
<FromGitter> <sdogruyol> @rishavs you ENV variables and a library for that https://github.com/gdotdesign/cr-dotenv
<FromGitter> <rishavs> thanks! i'll give it a try!
bjz has joined #crystal-lang
<FromGitter> <crisward> In crystal docs, is there anyway to control the navigation, ie group things under submenus etc?
Ven has joined #crystal-lang
bjz has quit [Ping timeout: 260 seconds]
bjz_ has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
A124 has quit [Ping timeout: 276 seconds]
A124 has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
<FromGitter> <rishavs> I didnt understand this bit in using dotenv; ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58a6e4cf21d548df2c2010a9]
<FromGitter> <rishavs> I just use it like this; `puts ENV["MY_VARIABLE"]`
Ven has quit [Ping timeout: 268 seconds]
<FromGitter> <in3rsha> How might I go about finding the SHA256 hash of a string using Crystal?
bjz_ has quit [Ping timeout: 240 seconds]
bjz has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
<FromGitter> <zatherz> I prefer to use an actual config file and then parse with with a YAML.mapping
<FromGitter> <zatherz> as opposed to untyped hashes
<FromGitter> <zatherz> @ezrast inersha: you can avoid the `map` and just do `"abcdefghijk".scan(/../).join &.[0]`
<FromGitter> <zatherz> `.join &.[0]` is syntax sugar for `.join {|m| m[0]}`
<FromGitter> <in3rsha> @zatherz Thanks :)
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter> <in3rsha> I've got a hex string that I want to hash using `OpenSSL::Digest.new("sha256")`. ⏎ ⏎ However, I need to convert the hex to *binary* first before I hash it. Can I convert hex to binary in Crystal?
<FromGitter> <in3rsha> Basically, I'm trying to write the Crystal equivalent of this Ruby function:
<FromGitter> <in3rsha> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58a6fced21d548df2c209943]
<FromGitter> <sdogruyol> oh hold on
<FromGitter> <sdogruyol> i've done something like that
<FromGitter> <sdogruyol> @in3rsha this can give you some hint a bit dirty but https://gist.github.com/sdogruyol/feb7042e68efe992a9f5d518634f8898
<FromGitter> <in3rsha> @sdogruyol Ha, thank you. I will take a look.
pawnbox has quit [Remote host closed the connection]
<FromGitter> <mgarciaisaia> Hi everyone! :) ⏎ Is there any guide/article written about debugging memory issues with a Crystal program? Or any advise at all - so I could *maybe* write that guide later? ⏎ I'm trying RX14's camo.cr under some load, and it's growing in memory usage - I'd like to trace why. Any tool I could use?
<RX14> that's CPU profiling, not memory allocation profiling
<RX14> it could be the stat objects just not being collected
<RX14> how much does it leak?
<FromGitter> <mgarciaisaia> It's using 32.7MB (as reported by `systemctl` on a CentOS box) after having redirected (not proxied) 4640 requests in 9 hours. It started with 13MB, and is slowly growing.
<RX14> hmm
<RX14> it's not much of a leak is it
<RX14> i doubt thats a "real" leak
<RX14> just the GC deciding that allocating is cheaper than running a GC collection
<RX14> if it grows abover 100MB I would start to get worried
<RX14> if you graph it over time I would guess that the memory growth slows down or stops
<FromGitter> <mgarciaisaia> I'm sampling it every 10 minutes - here's the log: https://gist.github.com/matiasgarciaisaia/49780e2c3f6f36eba06025ccbbe24387
<RX14> let me check on my instance...
<FromGitter> <mgarciaisaia> It very well may be that's just the GC making decisions - but, as you said you had problems, I wanted to check just to be sure
<FromGitter> <mgarciaisaia> I've limited the process' memory usage at 100MB via systemd, anyways, so it shouldn't grow over that - I hope the OS will restart it in that case
<RX14> my camo is using 17.8MB of ram
<RX14> and $ curl http://172.18.0.10:8080/
<RX14> ok 1/7558 since 2017-02-12 22:01:30 +0000
<RX14> huh I guess my restart script didn't work
<FromGitter> <mgarciaisaia> Hehe ^_^
<RX14> interesting
<FromGitter> <mgarciaisaia> Anyways, I'm going to read that post to see if I arrive to its memory/Linux counterpart - thanks Serdar :+1:
<RX14> i'm still getting the connect timeouts for stuff that I can curl from inside the same docker container
<RX14> which is super weird
<FromGitter> <mgarciaisaia> That doesn't have anything to do with the max open files, does it? Things like the sockets staying in the pre-closed state (`WAIT_CLOSE`?) and the process hitting the limit? ⏎ 7k reqs in 5 days aren't that much, either
<RX14> well there's cloudflare in front of the camo instance
<RX14> which is why the request rate os so low
pawnbox has joined #crystal-lang
<FromGitter> <fridgerator> is there a way to use `OptionParser` in development? it looks like the crystal cli is capturing the arguments
<RX14> you mean your aguments aren't being passed through?
<RX14> with crystal run you need to use -- to seperate crystal args from program args
<RX14> crystal run foo.cr -- args
<FromGitter> <fridgerator> i'm trying `crystal src/parser.cr -f filename.txt`
<FromGitter> <fridgerator> i'm getting `Error: You have input an invalid format, only text and JSON are supported`
<RX14> yes, so you need to use -- as I said
<FromGitter> <fridgerator> ah
<FromGitter> <fridgerator> ok, thanks
akwiatkowski has quit [Ping timeout: 260 seconds]
<RX14> is there a sensible way to decode a hex string into a slice?
<crystal-gh> [crystal] matiasgarciaisaia pushed 2 new commits to master: https://git.io/vDHKH
<crystal-gh> crystal/master a068d41 Matías García Isaía: Merge pull request #4043 from matiasgarciaisaia/redundant-osx-builds...
<crystal-gh> crystal/master 09bb1fe Matias Garcia Isaia: Avoid redundant builds of OSX with xcode7.3...
<FromGitter> <asterite> I was thinking the same thing, it's a very common functionality, we should add it to the std
<FromGitter> <asterite> Problem is, I don't know exactly where :-)
<FromGitter> <asterite> There's Bytes#hexstring that does Bytes -> String... Maybe we can add String#hexbytes or similar... Or maybe Bytes.from_hexstring, or Bytes.hexstring
<RX14> I was thinking Bytes.from_hex
<RX14> or hexstring
<RX14> @asterite can you tell this guy he's wrong, I don't have enough rep: http://stackoverflow.com/a/42301536/2035962
<FromGitter> <asterite> Done! :)
<RX14> thanks
<RX14> I don't use stackoverflow enough, even though I get notifications for the crystal-lang tag
<FromGitter> <asterite> Thanks for letting me know. I saw that issue and it opened a lot of questions. For example I don't like the current OpenSSL::Digest design, we should probably have digests inside Digest... And then there's the missing hexstring -> bytes
<RX14> indeed
<FromGitter> <asterite> The method is probably better if in String, so you can do "abcd".hexbytes or similar, instead of Bytes.hexstring("abcd") (longer and less fluid)
<RX14> OpenSSL::Digest should probably still exist
<RX14> but be ;nodoc:
<RX14> and used exclusively from Digest::SSHA1 classes
<FromGitter> <asterite> Yes, I don't know... Maybe Ruby is the only language that exposes OpenSSL in the standard library... it should be an implementation detail
<FromGitter> <asterite> Same as Ruby's zlib. It's like everything is provided as a binding to a library that solves a problem, instead of as a library that solves a problem
<RX14> well I think that OpenSSL should stay for now
<RX14> but be slowly abstracted away
<RX14> before 1.0
<FromGitter> <asterite> Sure
<RX14> i think being able to plug in other implementations instead of openssl would be great
<RX14> especially for portability
<RX14> wouldn't particularly want openssl on a microcontroller...
<FromGitter> <asterite> Maybe reimplementing it in Crystal or bindings to a C file of our own is best. For example Go reimplements everything from scartch (but then again, it's Google)
<FromGitter> <asterite> Hm, I wanted to edit the previous message and accidentally hit delete. No confirmation :-(
<RX14> well I can see it from IRC
<RX14> can't delete messages from there :)
<RX14> but again personally I'd stick with "don't roll your own crypto"
<RX14> and advise heavilly against doing what go does
<RX14> and instead look to make the crypto backends plugable so we could take advantage of future improvements elsewhere
<RX14> such as maybe smaller crypto/digest libraries
<RX14> which we can statically link
<RX14> which gets us practically the same benefits of writing our own crypto in crystal while using a well-used auditable implementation
<RX14> s/auditable/audited
<FromGitter> <drosehn> aside --> I'd actually like to write some of the digest functions in crystal, but just as a personal project. Just digests, nothing with encryption!
<RX14> well we have Digest::SHA1 in crystal already
<RX14> i'm sure SHA256 and above could happen too
<FromGitter> <drosehn> Oh. I hadn't looked at that, so I thought that was calling openssl.
<FromGitter> <rishavs> basic question; how do i do `if a = 0` ? am i supposed to use == or something?
<RX14> although i'm concerned about side channels and timing attacks when compiling the digests in release mode
<RX14> @rishavs testing for equality is done using ==
<RX14> what languages have you used before?
<FromGitter> <sdogruyol> there also this question on SO http://stackoverflow.com/questions/42302000/encoding-ascii-getbytescarr-in-crystal
<FromGitter> <rishavs> @RX14 lets just pretend i didnt ask that. i am retarded. >.>
<RX14> @sdogruyol yeah I don't even know what's going on there
<RX14> oh
<RX14> I see
<RX14> i see
<RX14> in C#, \x00bf is being interpreted as an escape
<FromGitter> <drosehn> Interesting.
<travis-ci> crystal-lang/crystal#a068d41 (master - Merge pull request #4043 from matiasgarciaisaia/redundant-osx-builds): The build has errored. https://travis-ci.org/crystal-lang/crystal/builds/202652541
<DeBot> https://github.com/crystal-lang/crystal/pull/4043 (Avoid redundant builds of OSX with xcode7.3)
<crystal-gh> [crystal] karlseguin opened pull request #4047: Optimize Set#&, Set#clone and Set.new (master...feature/set_opt) https://git.io/vDHbw
<FromGitter> <zatherz> is there any nice way to workaround the fact that when you include a module with a macro that uses `@type` inside
<FromGitter> <zatherz> it'll always refer to the module
<FromGitter> <zatherz> instead of the class the module was included in
<RX14> it shouldn't do
<RX14> @zatherz it works: https://carc.in/#/r/1nb4
<FromGitter> <zatherz> RX14: https://carc.in/#/r/1nb5
<RX14> yeah thats right
<FromGitter> <zatherz> ?
mark_66 has quit [Remote host closed the connection]
<RX14> that is correct behaviour
<RX14> put that macro inside included if you want it to work the other way
<FromGitter> <zatherz> ```code paste, see link``` ⏎ ⏎ any idea why `@type.instance_vars` inside `macro finished` inside `macro included` inside MagicJSON expands to an empty ArrayLiteral? [https://gitter.im/crystal-lang/crystal?at=58a72f48de50490822df0852]
<RX14> you might not have escaped the macro code?
<RX14> or idk
<FromGitter> <zatherz> nope, same result when I put a backslash
<FromGitter> <asterite> It's because the macro is processed in the first pass, in which the type of instance variables is not yet computed
<FromGitter> <zatherz> why
<FromGitter> <asterite> Because that's how the compiler works
<FromGitter> <asterite> What do you need to do?
<FromGitter> <asterite> I guess you need something like what's mentioned here: https://github.com/crystal-lang/crystal/issues/3620 . In short, all of these workarounds will stop being needed once we implement some form of 3620... I've seen this is very annoying in several projects now
<FromGitter> <zatherz> iterate through instance variables in the macro named "finished" that "can be thought as if it's placed at the end of the program" but is still processed early
<FromGitter> <zatherz> you guessed correctly
<FromGitter> <asterite> Until we implement that there's no nice solution to the problem with the current language... I'm pretty sure of that
<FromGitter> <zatherz> `finished` seems kinda not-useful-at-all then
<RX14> finished should let you iterate instance vars
<FromGitter> <asterite> Well, you can use it but you can't use instance variables there. Actually, you can if you define a method and use it there, but escaping with \{...}
<FromGitter> <zatherz> but what would I put in the method if I can't iterate instance vars in the first place?
<RX14> you can iterate instance vars
<FromGitter> <asterite> You can. Macros in methods are expanded when invoked... I'm not saying that's something good or intuitive, it's just the way it works right now. Macros need an entire redesign
<FromGitter> <zatherz> oh, you mean like escape the macros and create a method with macros and then call that method
<FromGitter> <asterite> Actually, if you want MagicJSON then you don't need finalize... just a sec
<FromGitter> <asterite> Also, maybe you should look into this: https://github.com/kostya/auto_json
Raimondi has quit [Ping timeout: 268 seconds]
<FromGitter> <asterite> (which again, I don't think will be necessary once we implement something like the meta attribute)
<FromGitter> <zatherz> saw it, it requires you to use `field` to define the fields
mhib has joined #crystal-lang
<FromGitter> <asterite> Something like this? https://play.crystal-lang.org/#/r/1nb8
Raimondi has joined #crystal-lang
<FromGitter> <zatherz> is there something funky going on with including a module that defines an `initialize`
<FromGitter> <zatherz> @asterite yes, exactly like that, I made it work with from_json too
<RX14> I have to say I think overuse of meta attributes is quite ugly
<RX14> maybe it's best to explore other areas before adding them
<FromGitter> <asterite> But it works like that in every other statically typed language
<RX14> it does
<FromGitter> <asterite> In Java you do it with attributes, in C# too...
<FromGitter> <asterite> In Go too...
<RX14> and it's ugly
<FromGitter> <asterite> :-P
<RX14> in go it's less ugly
<RX14> because they have that weird-ass syntax
<FromGitter> <asterite> Why less ugly?
<FromGitter> <asterite> Well, but in any case it's metadata attached to "instance variables"
<RX14> it is
<FromGitter> <asterite> then you traverse it and that's it... right now you have to store that info somewhere else
<RX14> i can't think of a better way to do it
<RX14> but i wish there was
<FromGitter> <asterite> Yeah, me too... in fact, right now it's not like that because we didn't like the other approach
<FromGitter> <asterite> but it breaks with inheritance, and there's also the thing that you sometimes duplicate types... like if you define JSON and YAML mapping...
<RX14> indeed
<RX14> but then you end up with @[JSON, YAML] on every instance variable
<RX14> which is also ugly
<RX14> actually
<RX14> for most cases you could probably just put @[JSON, YAML] on the class
<RX14> maybe be able to do that + blacklist
snsei has joined #crystal-lang
<RX14> say everything but this variable should be serialized
<FromGitter> <zatherz> ???
<FromGitter> <zatherz> I tried another approach too https://play.crystal-lang.org/#/r/1nbf
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter> <zatherz> the obvious doesn't work https://play.crystal-lang.org/#/r/1nbg
<FromGitter> <asterite> RX14 yeah, that's another approach... I think in Java/C# you put an ignore attribute... Maybe that's controlled with an attribute at the class level (to say if the default is include-all of ignore-all)
<RX14> actually yeah
<RX14> how about this:
<RX14> keep JSON.mapping and make it argless
<RX14> it reads all instance vars and generates pretty much the same as it does now
<RX14> then you can annotate with @[SerialiseIgnore]
<RX14> or something similar
<FromGitter> <zatherz> why keep JSON.mapping instead of an attribute on the class
<RX14> more crystally in my opinion
<Papierkorb> RX14: That's comparable how I do it in Cannon
<FromGitter> <zatherz> doesn't it kind of defeat the point though
<Papierkorb> except for the @[] stuff which isn't customizable iirc
<FromGitter> <zatherz> again, why does this not compile? https://play.crystal-lang.org/#/r/1nbd
<FromGitter> <zatherz> eh
<Papierkorb> Something like this really works btw https://github.com/Papierkorb/cannon/blob/master/samples/custom_type.cr#L4
<Papierkorb> There's no reason why something like it wouldn't for JSON or YAML or anything else
<FromGitter> <zatherz> you have to remember to run the mapping method on every single subclass
<RX14> @zatherz wouldn't that be the same for @[JSON] too
<Papierkorb> sub-classing serializable classes sounds funny
<FromGitter> <zatherz> RX14: not necessarily
<FromGitter> <zatherz> once again, why does this not compile, and is there any way to work around that? https://play.crystal-lang.org/#/r/1nbd
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
<FromGitter> <zatherz> so apparently crystal only looks at the code of initialize to check if instance variables are all assigned properly, instead of also looking into the code of the methods that are ran in initialize?
<FromGitter> <zatherz> amazing
<RX14> yes
<RX14> doing that would be vertually impossible
<RX14> virtually*
<FromGitter> <zatherz> well then is there any way to properly do that in initiailze
<BlaXpirit> zatherz, well yes just assign things to variables in initialize. one thing you could do to split it up is make functions that return something that you assign to a variable (in initialize), instead of just calling methods that assign things
<RX14> as long as there is an assign in initialize it works
<RX14> you can do for example
<BlaXpirit> not sure what this example shows
<RX14> @a, @b, @c = some_method
<RX14> to split it up
<RX14> but you don't seem to be doing that in that example
<RX14> it just looks weird
<FromGitter> <Sija> @zatherz https://gist.github.com/Sija/d0559921a7763b6f4407b441f04dabe0 - check this out, might help
<FromGitter> <zatherz> BlaXpirit: the `initialize` doesn't seem to be included at all
<FromGitter> <zatherz> this error makes no sense https://play.crystal-lang.org/#/r/1nc2
<RX14> @zatherz no it doesn't
<FromGitter> <zatherz> why does it happen then
<FromGitter> <zatherz> it covers all possible cases right? read_object block is not ran => raise, read_object block is not ran with all the keys => raise, etc
mhib has quit [Ping timeout: 260 seconds]
<FromGitter> <zatherz> I'm guessing it's a bug of some sort
mhib has joined #crystal-lang
<RX14> probably
<RX14> dump the expanded code
<FromGitter> <zatherz> how do you even use crystal tool expand
<FromGitter> <zatherz> --help doesn't even say that `-c` is necessary
<FromGitter> <zatherz> makenowjust's asciinemas use a custom vim command
<RX14> doesn't make sense to me
mhib has quit [Read error: Connection reset by peer]
<FromGitter> <zatherz> ugh
akwiatkowski has joined #crystal-lang
Svenskunganka has quit [Quit: leaving]
sz0 has quit [Quit: Connection closed for inactivity]
bjz has joined #crystal-lang
sz0 has joined #crystal-lang
unshadow has joined #crystal-lang
unshadow has quit [Quit: leaving]
snsei has quit [Remote host closed the connection]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
crack08 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <sdogruyol> anyone here?
<FromGitter> <sdogruyol> trying to compile Crystal thread-support branch yet failing ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58a76c2ef045df0a225fdfdd]
<FromGitter> <sdogruyol> any help is welcome :smile: (BTW i got concurrencykit)
<RX14> think you need a custom libgc version too
<RX14> there's a bdwgc fork with a patch somewhere
<RX14> which needs to be compiled then libgc.a copied to where that path says
bjz has joined #crystal-lang
<FromGitter> <sdogruyol> naruhodo
<FromGitter> <sdogruyol> thanks @RX14
<FromGitter> <sdogruyol> how would i compile and link this to `make crystal`
<RX14> check it out then follow the build instructions in the readme: https://github.com/ivmai/bdwgc#installation-and-portability
<RX14> then find gc.a or libgc.a and copy it over
<RX14> (i havent tried this)
<FromGitter> <sdogruyol> thanks :P
<RX14> oh
<RX14> here
<RX14> `make -f Makefile.direct`
<RX14> should generate gc.a
<FromGitter> <sdogruyol> yeah i've generated and copied it over
<RX14> nice
<RX14> one of the examples was updated
<RX14> should be easy to test with
<FromGitter> <sdogruyol> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58a774fb00c00c3d4f52d7fc]
<FromGitter> <sdogruyol> this seems a bit harder though :P
<RX14> ah...
<RX14> that's new
<FromGitter> <sdogruyol> yeah
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 268 seconds]
<RX14> oh wow i'm so going to do something like this for crystal: https://github.com/Shyp/go-dberror
<FromGitter> <ggiraldez> @sdogruyol you need to install libgc into the `/opt/bdwgc` prefix... the crystal repo contains a symlink to the library if installed there
<RX14> @ggiraldez i think serdar put the static library in pllace of the symlink
pawnbox has quit [Remote host closed the connection]
<FromGitter> <ggiraldez> @sdogruyol in bdwgc, run `./autogen.sh && ./configure --prefix /opt/bdwgc && make install`
<FromGitter> <ggiraldez> you should have permissions on `/opt/bdwgc` though
pawnbox has joined #crystal-lang
<FromGitter> <ggiraldez> @RX14 that *should* work too, but IIRC there was some other quirk with it
<FromGitter> <ggiraldez> don't remember what was it though
<FromGitter> <ggiraldez> also, @sdogruyol make sure you have the `release-7_4-crystal` branch checked out as @RX14 wrote previously
<FromGitter> <sdogruyol> @ggiraldez i've already done that
<FromGitter> <sdogruyol> let me use opt
<FromGitter> <ggiraldez> btw, do keep in mind that currently, the compiler compiled with threading support will be slower than the stable/master branch because we had to disable parallel llvm codegen
<FromGitter> <sdogruyol> i just want to try it out :)
<FromGitter> <sdogruyol> thanks for the heads up
<FromGitter> <ggiraldez> cool :)
pawnbox has quit [Ping timeout: 260 seconds]
<FromGitter> <ggiraldez> if you have 0.20.4 installed, you can do `make deps` and then use the std from the repo which will result in compiled executables that include threading support; either set the `CRYSTAL_PATH` or use the `bin/crystal` script
<FromGitter> <ggiraldez> 1) 20.5 should work too i guess
<FromGitter> <sdogruyol> so i've compiled bdwgc in opt/bdwgc
<FromGitter> <sdogruyol> but symlink doesnt seems to work
<FromGitter> <sdogruyol> using 0.20.5
<FromGitter> <ggiraldez> hmm... this is what i have:
<FromGitter> <ggiraldez> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58a779fc872fc8ce624d81bd]
<FromGitter> <sdogruyol> ah hold on
<FromGitter> <sdogruyol> forgot to symlink
<FromGitter> <ggiraldez> ah :)
<FromGitter> <sdogruyol> GOT IT :tada:
<FromGitter> <sdogruyol> thank you @ggiraldez
<FromGitter> <sdogruyol> <3
<FromGitter> <ggiraldez> :D
<FromGitter> <ggiraldez> awesome!
<FromGitter> <ggiraldez> np
<RX14> hmm, i wonder why the path matters then, i'll keep that in mind if I try it out
<FromGitter> <ggiraldez> :+1:
<FromGitter> <sdogruyol> now time to play :)
<RX14> check out this cool SQL macro I just made: https://gist.github.com/RX14/70cb68c564acd6c42920530cd3bfc69d
<RX14> I love SQL for queries but inserts and updates are pretty annoying
<FromGitter> <sdogruyol> that's cool :+1:
<FromGitter> <sdogruyol> it really uses all the cpus @ggiraldez :+1:
<FromGitter> <ggiraldez> it will depend heavily on the type of load you feed it, but yeah, it should
<FromGitter> <ggiraldez> for i/o bound loads or heavy channel use it's probably slower than the single threaded version still
<FromGitter> <sdogruyol> i assume that you know that it's slower compared to current single threaded model
<FromGitter> <ggiraldez> also, the number of scheduler threads is hardcoded to 8 for now
<FromGitter> <ggiraldez> yeah
<FromGitter> <sdogruyol> yup Kemal doesn't play well with this for now :D
<FromGitter> <sdogruyol> it works BTW
<FromGitter> <ggiraldez> cool!
<FromGitter> <sdogruyol> just curious if it's thread-safe or not
<FromGitter> <ggiraldez> heh! that depends on what you're doing and what data you share among fibers
<FromGitter> <sdogruyol> it's just HTTP servicing
<FromGitter> <sdogruyol> guess there's no sharing between Fibers
<FromGitter> <ggiraldez> that should work fine then
<FromGitter> <ggiraldez> i'm sure there are plenty of bugs remaining in the std lib still, but we're slowly ironing them out
<FromGitter> <sdogruyol> that's really great
<FromGitter> <sdogruyol> i'll try to be as helpful as possible doing some tests, use cases e.g
<RX14> I've written a nice somewhat-opinionated REST api framework for this forum I'm writing and i'm feeling pretty productive in it so far, might clean it up and open source it eventually
<FromGitter> <sdogruyol> great
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
sz0 has quit [Quit: Connection closed for inactivity]
pawnbox has joined #crystal-lang
crack08 has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]