RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.26.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
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
marmotini_ has joined #crystal-lang
wontruefree has quit [Ping timeout: 260 seconds]
wontruefree has joined #crystal-lang
wontruef_ has joined #crystal-lang
wontruefree has quit [Ping timeout: 250 seconds]
f1refly has quit [Ping timeout: 276 seconds]
Heaven31415 has quit [Quit: Leaving]
marmotini_ has quit [Ping timeout: 252 seconds]
marmotini_ has joined #crystal-lang
wontruef_ has quit [Quit: bye]
marmotini_ has quit [Remote host closed the connection]
marmotini_ has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
marmotini_ has quit [Ping timeout: 268 seconds]
marmotini_ has joined #crystal-lang
marmotini_ has quit [Read error: Connection reset by peer]
marmotini_ has joined #crystal-lang
marmotini_ has quit [Read error: Connection reset by peer]
marmotini_ has joined #crystal-lang
marmotini has joined #crystal-lang
marmotini_ has quit [Ping timeout: 252 seconds]
rohitpaulk has joined #crystal-lang
marmotini has quit [Ping timeout: 252 seconds]
DTZUZO_ has quit [Ping timeout: 246 seconds]
maxpowa has quit [Ping timeout: 268 seconds]
maxpowa has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter> <Heaven31415> Hi
<FromGitter> <Aaron-JM> Hey
flaviodesousa has joined #crystal-lang
maxpowa has quit [Ping timeout: 252 seconds]
maxpowa has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 244 seconds]
<FromGitter> <straight-shoota> @roblally_twitter I wouldn't use `before_each` ever, because it's a global handler running before each and every single spec in the suite. Better make it a spec helper and call it explicitly in every spec that needs it.
<FromGitter> <yxhuvud> The built in spec runner is quite .. limited when you are used to rspec.
flaviodesousa has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
<FromGitter> <straight-shoota> Yes. But I kind of think that's a good thing. It force you to write more expressive specs. You don't need to be aware of some hooks and handlers hidden somewhere else in order to understand what a single spec does.
Raimondii has joined #crystal-lang
ashirase has quit [Ping timeout: 252 seconds]
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
ashirase has joined #crystal-lang
<FromGitter> <yxhuvud> I agree that rspec is a bit too magical, but I think it would be possible to build something in between of todays extremely minimalistic way and what rspec is.
<FromGitter> <straight-shoota> Maybe... but I honestly don't feel like I'm missing something.
<FromGitter> <straight-shoota> And I think I've quite literally written thousands of specs.
DTZUZO_ has joined #crystal-lang
sagax has quit [Remote host closed the connection]
rohitpaulk has joined #crystal-lang
silmanduin has joined #crystal-lang
<silmanduin> hello
<FromGitter> <silmanduin> Hello
<z64> hi
<FromGitter> <silmanduin> Can someone help me? i still havent figured out how to run a *.ll file generated by crystal
silmanduin has quit [Quit: Page closed]
<FromGitter> <Prutheus> Hello. I am using Jennifer as ORM. I want to store some database rows (as array: `Array(Search)` where Search is `class Search < Jennifer::Model::Base` in a map: `{status: "200 OK", searches: searches}`. When I do a `.to_json` on that map, i can’t compile my program anymore, it complains about JSON::Builder error …. any idea how to fix that?
<FromGitter> <Prutheus> why does the json builder not know how to build json from that data class? can i specify that somewhere in the `Search` class?
<FromGitter> <proyb6> @silmanduin is ll format is from Crystal programming language?
<FromGitter> <silmanduin> yes it is
<FromGitter> <silmanduin> but how to link pcre and other libraries ?
<FromGitter> <silmanduin> ( generated by --emit llvm-ir
<z64> @silmanduin this is a little naive suggestion maybe, but maybe check out `--cross-compile` instead. it emits *.o, but will show you the linker commands to run with `cc`
<FromGitter> <silmanduin> oh i see, but my goal is to understand how LLVM works step by step :-)
<z64> @silmanduin right. crystal uses LLVM bindings; if you are working with .ll files yourself i believe one would use `llc`. see https://llvm.org/docs/CommandGuide/llc.html for the general guide; the first sentence seems to describe the workflow of llvm ir -> llc -> asm -> executable. you would use `gcc` etc to do this last step
marmotini_ has joined #crystal-lang
<FromGitter> <silmanduin> with either lli or llc, i run into the same problem: lpcre and other libraries are not linked. In both cases ( i get "LLVM ERROR: Program used external function 'pcre_malloc' which could not be resolved!" )
<FromGitter> <silmanduin> ( llc used with the *.bc file, generated by --emit llvm-bc )
<z64> not sure sorry - this really isn't the best place for these questions; best to find a resource/forum/documentation specifically for llvm
<FromGitter> <silmanduin> okay let me redirect my problem : ⏎ ⏎ 1) when i do " crystal build something.cr " , the process above is actually done in 1 go from cr to asm ? ( and uses LLVM right ? ) ⏎ 2) my goal is to do the steps manually , and the answers probably lie somewhere behind the crytal build function , just i know too few about the crystal compiler to find out by myself how it is done.
<FromGitter> <Schniz> Hi! is there a way to get nightly crystal in a tarball?
<FromGitter> <Schniz> instead of docker
<FromGitter> <Schniz> for some reason Travis acts super slow with docker
<FromGitter> <Schniz> have you ever had Travis acts up slow with `sudo: required` and docker? cc @vladfaust
<FromGitter> <vladfaust> Absolutely yes
<FromGitter> <vladfaust> I'm considering moving to Circle CI
<FromGitter> <vladfaust> Also it's messed up with that migration from .org to .com thing
<FromGitter> <Schniz> Okay. I'll try to migrate to Circle CI as well. It worked amazingly good in my last workplace 👍
<FromGitter> <Schniz> thanks Vlad :)
<FromGitter> <vladfaust> Yeah, no problem. It would be great if you shared nightly config here when succeeded
<FromGitter> <Schniz> 👍
<FromGitter> <Schniz> woah, super ugly emoji ⏎ 👍
<FromGitter> <Schniz> WOAH
<FromGitter> <Schniz> circleci is super fast compared to travis!
<FromGitter> <Schniz> 💰
rohitpaulk has quit [Ping timeout: 250 seconds]
marmotini_ has quit [Ping timeout: 250 seconds]
marmotini_ has joined #crystal-lang
<FromGitter> <straight-shoota> @bew why are you mad at me? :)
moei has joined #crystal-lang
<FromGitter> <bew> Naa, now we just need to update crystal in atom language specifications :p
wontruefree has joined #crystal-lang
<FromGitter> <bew> Ah "why": because you said that github was using highlightjs and so we needed to update the language specifications there to support new keywords on github, but it turns out it's another project
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 272 seconds]
DTZUZO_ has quit [Ping timeout: 252 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <straight-shoota> oh, did I?
<FromGitter> <straight-shoota> Well, the docs use highlightjs. And many others, too.
<FromGitter> <bew> Or it was someone with a verhrry similar username?
sagax has joined #crystal-lang
<FromGitter> <bararchy> @vladfaust @Schniz we use circleCI its much faster then Travis and the overall process makes much more sense + gotta love the "workflow" config
<FromGitter> <roblally_twitter> @straight-shoota Yeah, I came to the conclusion that it was questionable when I saw the signature. I had originally assumed that it would be Context specific and when it wasn't I dropped it. I am 100% with @yxhuvud though, spec as it stands is probably too limited for my tastes. Repeating the same code over and over masks the wood with too many trees making it harder to spot the essence of what is
<FromGitter> ... being tested, creating boilerplate code that we assume will be the same so we don't read it... but sometimes it isn't, and creating an impediment to refactoring because I have to change so many different places. I appreciate that other people can have different perspectives, but I've been TDDing code since 1999 and, after tryi ... [https://gitter.im/crystal-lang/crystal?at=5bca0dd11c100a4f29b02b7d]
non-aristotelian has joined #crystal-lang
<FromGitter> <nekocentral> I'm trying to get a timeout set on the http::client.get is that possible?
<FromGitter> <nekocentral> I tried adding the class to but failed
<FromGitter> <fridgerator> does this work ? https://crystal-lang.org/api/0.26.1/HTTP/Client.html#connect_timeout%3D%28connect_timeout%3ATime%3A%3ASpan%29-instance-method
<FromGitter> <nekocentral> i tried that but to google with tls=true but got a compile error witht htat
<FromGitter> <nekocentral> https://paste.ee/p/jEYdO
<FromGitter> <nekocentral> I'm basicly trying to see if your online by connecting to google or something else
<FromGitter> <fridgerator> try this instead `internet = HTTP::Client.new("https://www.google.com", tls: true)`
<FromGitter> <nekocentral> kk let me try one moment
<FromGitter> <fridgerator> the `true` argument in your example is passing in the place of the `port`
<FromGitter> <nekocentral> a that is a fail sorry xD
<FromGitter> <fridgerator> hrmm, well nevermind there are overrides for `tls` as the second parameter
<FromGitter> <fridgerator> nevermind again, tls is not a boolean type argument
<FromGitter> <nekocentral> https://i.haazen.xyz/VFuGU
<z64> you need to write `tls: true`as fridgerator explained, not `tls = true`
<FromGitter> <nekocentral> yea fixed that
<FromGitter> <nekocentral> sadly a connect_timeout doesnt work when offline and ends with a socker:error
<FromGitter> <nekocentral> https://i.haazen.xyz/qMrpO
<z64> indeed, you can't time out from trying to make a connection if you can't find where to connect to to begin with
<FromGitter> <Prutheus> Hello. How can I convert an XML::Node to JSON::Any ?
<FromGitter> <nekocentral> how would i catch and mabye shorten that timeout
<FromGitter> <nekocentral> as it now takes over 30 seconds
<z64> @nekocentral are you talking about the call to getaddrinfo?
<FromGitter> <asterite> @nekocentral dns timeout currently doesn't work in crystal
<FromGitter> <Heaven31415> Hi
<FromGitter> <Heaven31415> How can I test a compile time exception in a spec?
<oprypin> Heaven31415, can't
<FromGitter> <roblally_twitter> @Heaven31415 I don't think it is possible. But that's something I've always worried about: with a dynamic language I can write tests to ensure that something never happens even when the code changes. With a dynamic language, I can only write tests for the things that are currently possible.
<FromGitter> <Blacksmoke16> the spec wouldnt run so thats a good indication that something is wrong :p
<FromGitter> <markrjr> Maybe I'm overthinking this, but how would I convert from an int to an unsigned int?
<FromGitter> <Heaven31415> #to_u32
<FromGitter> <markrjr> ```doot = 5 ⏎ moot = doot.as(UInt32)``` [https://gitter.im/crystal-lang/crystal?at=5bca37abae7be9401683ee1b]
<FromGitter> <markrjr> Ah, thanks @Heaven31415
<FromGitter> <Heaven31415> Nope, you don't use as
<FromGitter> <markrjr> I was going off the GitBook.
<FromGitter> <Heaven31415> I really feel you, it isn't really documented anywhere
<FromGitter> <Heaven31415> If you are asking whether `as` is working the same way as `to_u32`, then I think the answer is no.
<FromGitter> <Heaven31415> `as ` isn't converting anything, it only tells type system to treat something like something else
<FromGitter> <markrjr> Ohhhhh.
<z64> yeah if you were referring to https://crystal-lang.org/docs/syntax_and_semantics/as.html - the context of the opening example is important. `a` *can be* Int32 or a String at runtime; `.as(T)` asserts that it will be a certain type, or raise an exception
<z64> as for casting, with most things you should refer to that types documentation https://crystal-lang.org/api/0.26.1/Int32.html#to_u32%3AUInt32-instance-method
<FromGitter> <markrjr> Ah, that makes a lot more sense. Thanks to you both.
<z64> you're welcome:)
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/59yx this also works
<FromGitter> <Blacksmoke16> for if the number is hardcoded of a given type
<FromGitter> <markrjr> That's really dope.
<FromGitter> <Blacksmoke16> but obs not for when the val is a variable
rohitpaulk has quit [Ping timeout: 246 seconds]
DTZUZO_ has joined #crystal-lang
DTZUZO_ has quit [Ping timeout: 250 seconds]
<FromGitter> <Heaven31415> If some object `foo` has instance var `x`. Why is writing something like this okay and what does it mean? `foo.@x` It seems it gives you a direct access to instance vars, without a need to call a method.
<FromGitter> <vladfaust> Oof, finally deployed it. Check https://crystaljobs.org. Gonna sleep for now, will approve jobs (if any) tomorrow. Sorry if it has bugs, staging went all good.
<FromGitter> <jwoertink> good work @vladfaust
<FromGitter> <vladfaust> Thank you :)
<FromGitter> <Heaven31415> I don't want to discourage you, it's really a nice idea, but isn't it a little too early?
<FromGitter> <jwoertink> It's never too early for greatness!
marmotini_ has quit [Ping timeout: 252 seconds]
wontruefree has quit [Quit: bye]
marmotini_ has joined #crystal-lang
silmanduin has joined #crystal-lang
<FromGitter> <girng> hello!!
DTZUZO_ has joined #crystal-lang
wontruefree has joined #crystal-lang
wontruefree has quit [Client Quit]
<FromGitter> <bajro17> its not early already crystal is so good. I already say this is what we need to make as much more is possible sites around crystal programming language some ecosystem. To more and more people hear about this beautiful project.
silmanduin has quit [Ping timeout: 256 seconds]
<FromGitter> <dscottboggs_gitlab> I'd rather fix a bug in crystal itself than try to write with my hand tied behind my back in go or bog down my code by writing in ruby or python
<FromGitter> <girng> ^^^
<FromGitter> <girng> Only dumb bugs i've ran into was WSL only
<FromGitter> <girng> That's not crystal's fault though so..
<FromGitter> <girng> It's a risk i'm willing to take for development, fine w/ me ;-)
<FromGitter> <girng> i'm converting this (https://www.youtube.com/watch?v=s67AYDD3j1E&t=900s) into my Monster class
<FromGitter> <girng> never used enum's before but i'm excited
root2 has joined #crystal-lang
<FromGitter> <Heaven31415> @girng I have some AI classes of my own in my space shooter game if you are curious, this is carrier for example (very similar to carrier from starcraft in terms of how it works): https://github.com/Heaven31415/CrystalSpaceShooter/blob/master/src/world/ai/ai_carrier.cr
root2 has quit [Quit: WeeChat 2.2]
<FromGitter> <bajro17> is this code good enough for router ⏎ ⏎ ```a = "test/:id" ⏎ ⏎ b = a[/:.+/i] ⏎ puts b.lchop``` [https://gitter.im/crystal-lang/crystal?at=5bca6d176e5a401c2d9c56fb]
<FromGitter> <bajro17> I want use it for parameters in combination with http params
<FromGitter> <dscottboggs_gitlab> since kemal already implemented that and I think lucky and amber have something similar, why not see how one of them implemented it?