RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.25.0 | 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
lvmbdv has quit [Remote host closed the connection]
faustinoaq has quit [Ping timeout: 276 seconds]
<FromGitter> <codenoid> this is awesome feature
<FromGitter> <Daniel-Worrall> I mean specs are already browsable
zachk has quit [Quit: Leaving]
<FromGitter> <fgimian> Hey guys, is there any easy way to convert a YAML::Any to a JSON::Any?
wontruefree has joined #crystal-lang
lvmbdv has joined #crystal-lang
<FromGitter> <codenoid> yaml parse -> .to_json ?
<FromGitter> <fgimian> that will go to straight text
<FromGitter> <fgimian> or am I incorrect?
<FromGitter> <codenoid> yaml parse -> crystal obj -> to_json -> json (?)
<FromGitter> <codenoid> 1) .as_h (?)
<FromGitter> <codenoid> cmiiw
<FromGitter> <fgimian> i think i still need to build a recursive function to do it because of course as_h will not convert the inner elements
<FromGitter> <fgimian> I'm writing a function to do it and will share
lvmbdv has quit [Quit: Leaving.]
<FromGitter> <fgimian> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b2ef21472b31d3691ee3d4c]
<FromGitter> <fgimian> I think this is the only way to get the job done 😄
snsei has joined #crystal-lang
<FromGitter> <Daniel-Worrall> This could possibly go in std
<FromGitter> <fgimian> Yeah, I just switched to a method called `as_json` in YAML
<FromGitter> <fgimian> one thing we're also missing are methods to convert `@raw` to bool
<FromGitter> <wontruefree> I am having trouble using `each` on JSON::Any am I missing something
<FromGitter> <wontruefree> I dont see an each in https://github.com/crystal-lang/crystal/blob/master/src/json/any.cr
<FromGitter> <fgimian> @wontruefree do you have a code sample?
<FromGitter> <Daniel-Worrall> JSON::Any acts as the container
<FromGitter> <fgimian> you can always access the raw data via `.raw` also
<FromGitter> <wontruefree> ah ok
<FromGitter> <wontruefree> I thought from the doc I could use `each`
<FromGitter> <wontruefree> is the reason why `[]` can be used on JSON::Any but not `each` because the interface is the same for Array and Hash?
<FromGitter> <fgimian> it simply hasn't been overloaded
<FromGitter> <fgimian> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b2efb1a59799e70173c902b]
<FromGitter> <fgimian> you could quite easily implement something similar for `.each`
<FromGitter> <fgimian> it's a bit of a slippery slope because one would ideally just replicate ALL functionality from Array and Hash
<FromGitter> <wontruefree> interesing
_whitelogger has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <conradwt> If someone has a chance, can they take a look at https://github.com/crystal-lang/shards/pull/214 ?
jcs has joined #crystal-lang
<FromGitter> <Daniel-Worrall> How can I decode gzip data from a string
<FromGitter> <conradwt> OK, everything is good with https://github.com/crystal-lang/shards/issues/214
<FromGitter> <Daniel-Worrall> https://carc.in/#/r/4dba
<FromGitter> <Daniel-Worrall> this is a body response from an api
<FromGitter> <bew> it's opening the file with name from the variable `body`
snsei has joined #crystal-lang
<FromGitter> <Daniel-Worrall> Can I use a tempfile?
<FromGitter> <bew> you don't need to use a file
<FromGitter> <bew> you can use an IO
<FromGitter> <Daniel-Worrall> yeah, I tried that and got an invalid header
<FromGitter> <bew> then you got your answer
<FromGitter> <bew> where is it coming from?
<FromGitter> <bew> does it work from sth else than crystal?
<FromGitter> <Daniel-Worrall> it works on their website :^)
<FromGitter> <Daniel-Worrall> reverse engineering because their website is slow to use
<FromGitter> <bew> they do work, for now
<FromGitter> <Daniel-Worrall> ``` "Content-Encoding" => "gzip", ⏎ "Content-Type" => "text/html; charset=UTF-8",``` [https://gitter.im/crystal-lang/crystal?at=5b2f21cdaeb8fa0c073d11fb]
<FromGitter> <bew> are you using the HTTP::Client from the stdlib? it should already handle gzip response
<FromGitter> <Daniel-Worrall> HTTP::Client, yes
<FromGitter> <asterite> Binary in string is possible, but you want \x for byte value. \u is unicode value, which is sometimes different
<FromGitter> <Daniel-Worrall> and that's the response body
<FromGitter> <S-YOU> Is that mean you can write `\x00` upto `\xff` and they remain as is, @asterite ?
<FromGitter> <asterite> Yes, that's correct
<FromGitter> <Daniel-Worrall> Well the header says it's gzip and that's the encoding I requested
<FromGitter> <bew> @Daniel-Worrall what is the expected response?
<FromGitter> <Daniel-Worrall> JSON array
<FromGitter> <Daniel-Worrall> odd... because this is unusable data
<FromGitter> <Daniel-Worrall> https://carc.in/#/r/4dbf
<FromGitter> <Daniel-Worrall> I would provide code for the API but it requires authentication
<FromGitter> <Daniel-Worrall> oh
<FromGitter> <asterite> What was it?
<FromGitter> <Daniel-Worrall> and so the response was not getting decoded
<FromGitter> <Daniel-Worrall> If I remove the header, it is added itself
<FromGitter> <Daniel-Worrall> I would consider that a bug though
<FromGitter> <asterite> Ah, yes, I was going to mention that, http client handles all of that transparently. And I think it's documented in the class (not sure)
<FromGitter> <Daniel-Worrall> it is documented
<FromGitter> <Daniel-Worrall> It's an odd behaviour though
<FromGitter> <asterite> Right, it doesn't say what happens when you do add the content encoding. I guess it doesn't decompress automatically and you have to do it
wontruefree has quit [Quit: bye]
<FromGitter> <Daniel-Worrall> now to check the source and see how I'm supposed to decompress it
<FromGitter> <Daniel-Worrall> but that helps my understanding.
<FromGitter> <Daniel-Worrall> I thought I was just requesting plaintext when I withheld the header
<FromGitter> <asterite> You are not supposed to decompress it, http client does it for you
<FromGitter> <Daniel-Worrall> yeah, that's fine. I'm just curious of the source code
<FromGitter> <fgimian> Guys, is there a way to set the indent level when using `to_json` ?
<FromGitter> <bew> iirc there is `to_pretty_json` where you can configure the indent
<FromGitter> <fgimian> thanks, let me check it out
<FromGitter> <fgimian> perfect, that's exactly what I needed
<FromGitter> <bew> yw ;)
<FromGitter> <fgimian> 😄
<FromGitter> <fgimian> Man I'm really loving Ameba
<FromGitter> <fgimian> @veelenga oh you're here, Ameba rocks! 😄
<FromGitter> <fgimian> it's saved me a few times already
<FromGitter> <bararchy> @fgimian we have it is part of our build
<FromGitter> <fgimian> awesome! yeah I'm using it constantly too and intend to use it with CI also
snsei has quit [Remote host closed the connection]
<FromGitter> <bararchy> TBH crystal compiler + specs + ameba makes for a really good safety net.
<FromGitter> <fgimian> very true yeah
<FromGitter> <S-YOU> Just wondering coverage can be done during compiling?
<FromGitter> <gdotdesign> there is https://github.com/anykeyh/crystal-coverage but I never could make it work
<FromGitter> <fgimian> thanks guys
<FromGitter> <fgimian> @S-YOU btw not sure if you saw my message earlier, but just wanted to thank you for your help with MD5, Brew opennssl is as fast if not faster than `md5sum` 😄
_whitelogger has joined #crystal-lang
<FromGitter> <S-YOU> I saw that, yw :)
<FromGitter> <S-YOU> apple make it 5x slower xD
Yxhuvud has quit [Read error: Connection reset by peer]
Yxhuvud has joined #crystal-lang
<FromGitter> <fgimian> Has anyone by chance configured the BracketHighlighter extension for Sublime Text to work with Crystal?
<FromGitter> <fgimian> this is what it does
<FromGitter> <fgimian> the Ruby regexes work for the most part with Crystal until you start adding macros
<crystal-gh> [crystal] ysbaddaden pushed 1 new commit to master: https://git.io/f4SwK
<crystal-gh> crystal/master e4a01b5 Fotis Gimian: Corrected missing return value in the FileInfo flags method
<FromGitter> <vladfaust> Oh, Sublime user here! I think that Crystal support of Sublime Text 3 is dead, you should migrate to VS Code (even if you have Mi Air 12.5 with 4 GB which starts to lag because of Electron on Linux)
<FromGitter> <vladfaust> @bew, ⏎ ⏎ > As a workaround you could capture the block of field, and use it ⏎ ⏎ Could you please provide a snippet? (ref: https://play.crystal-lang.org/#/r/4d6f) [https://gitter.im/crystal-lang/crystal?at=5b2f57b4d2abe46688858650]
<FromGitter> <vladfaust> *It's a call to @faustinoaq, I hope you fix those Sublime issues one day*
lvmbdv has joined #crystal-lang
<FromGitter> <fgimian> thanks for the tip @vladfaust
<FromGitter> <fgimian> it works well enough for me tbh, and I found VS Code just that bit too slow
<FromGitter> <bararchy> @fgimian I used sublime alot, but I just wanted the damn integrated terminal
<FromGitter> <fgimian> the integrated Terminal is a huge part of what I loved about VS Code too
<travis-ci> crystal-lang/crystal#e4a01b5 (master - Corrected missing return value in the FileInfo flags method): The build was broken. https://travis-ci.org/crystal-lang/crystal/builds/396014563
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
<FromGitter> <fgimian> @bararchy Have you adapted well with VS Code?
<FromGitter> <bararchy> I use @faustinoaq config file, then changed a few things + scry etc..
<FromGitter> <fgimian> kewl! 😄
<FromGitter> <Daniel-Worrall> I've been using RubyMine with Crystal syntaxer. Still quite broken but there's a lot I love about it
<FromGitter> <fgimian> never even considered that option 😄
<FromGitter> <Daniel-Worrall> I'm wanting to contribute to it so that I can use Goto's and code inspections
<FromGitter> <Daniel-Worrall> But that involves a lot of work with lexing
<FromGitter> <fgimian> yeah huge job
<FromGitter> <fgimian> but they have Kotlin and I guess unless the language becomes mainstream, it won't justify the amount of effort required
<FromGitter> <fgimian> 😄
<FromGitter> <Daniel-Worrall> If someone builds a good plugin for rubymine, it'd be a lot of the work done for them
<FromGitter> <shobhitic> How do you get syntax highlighting for `.ecr` files in Sublime Text 3?
<FromGitter> <fgimian> Hmm, I haven't actually edited an ECR file since starting with Crystal
<FromGitter> <shobhitic> Y'all just use it for APIs?
<FromGitter> <fgimian> I'm personally using it for a Mac automation system which I'm re-developing in Crystal
<FromGitter> <fgimian> Just using Crystal for fun in my personal time, not for work yet. But I do intend to use it for a small internal API at work.
That_Guy_Anon has joined #crystal-lang
<crystal-gh> [crystal] kostya opened pull request #6252: Add global annotation Property (master...annotation_property) https://git.io/f4SK1
jfo_test has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 264 seconds]
<FromGitter> <vladfaust> @shobhitic it often works with `.erb` syntax highlighting
<FromGitter> <shobhitic> Ahh, nice hack
<FromGitter> <faustinoaq> @vladfaust @fgimian I'm not a sublime text user 😅 Would you like to be member on sublime-crystal repo?, so you can review new contributions 😉
<FromGitter> <fgimian> My experience with developing Sublime Text extensions is honestly very limited to be completely honest, so I'll have to pass for now if that's cool. But I'll definitely let you know if time crops up in the near future so I can help out.
<FromGitter> <faustinoaq> Scry (https://github.com/crystal-lang-tools/scry) is a common server protocol, so all scry features (completion, symbols, rename, diagnostics, etc) should be available across all editors 😅
<FromGitter> <faustinoaq> @fgimian Oh ok, no problem 👍
<FromGitter> <faustinoaq> > should be available across all editors ⏎ ⏎ *Once we fix some protocol issues* 😅
<FromGitter> <fgimian> I can see you have so many projects to look after mate
<FromGitter> <fgimian> Guys, I'm sure this is a silly question, but why oh why won't this work : https://play.crystal-lang.org/#/r/4dec
<FromGitter> <fgimian> I've said it COULD be an Int32, but I shouldn't have to specify that in the value should I? Because I could add an Int32 later.
<FromGitter> <gdotdesign> the compiler can only infer the type of the array to `Array(String)`
<FromGitter> <gdotdesign> you need to explicitly say `[ "Test1", "Test2" ] of String | Int32`
<FromGitter> <fgimian> oh yes
<FromGitter> <bew> You can do https://play.crystal-lang.org/#/r/4def
<FromGitter> <fgimian> my bad, sorry guys
<FromGitter> <fgimian> I'm so happy right now, just managed to port my Launchpad builder to Crystal
<FromGitter> <fgimian> what this does is allow you to specify all your apps in a YAML file and it builds your Mac Launchpad automatically by manipulating the SQLite database
<FromGitter> <fgimian> I spent a long time writing this in Python and just finished the initial porting to Crystal
<FromGitter> <fgimian> yeah!!! it's really clean
<FromGitter> <fgimian> Initial version up if anyone wants to see the fun I had to go through to build the Launchpad SQLite database 😄 https://github.com/fgimian/launchpad.cr/tree/master/src/launchpad
<FromGitter> <fgimian> extractor = extracts the layout, builder = takes your layout and builds the database
<FromGitter> <fgimian> Still a few important TODOs, but it's getting there faster than I expected 😄
<FromGitter> <bararchy> @fgimian no README.md makes me a sad panda
<FromGitter> <fgimian> hahaha just my first commit
<FromGitter> <fgimian> but still there's nothing in the README just yet 😄
<FromGitter> <fgimian> My last question for the evening
<FromGitter> <fgimian> looks like I have to use `.map`, there's an example in the docs doing this https://crystal-lang.org/docs/syntax_and_semantics/as.html
<FromGitter> <fgimian> that works 😄
<FromGitter> <fgimian> OK, I'm done for the day, good night guys 👋
<FromGitter> <abdllhygt> Hi!
<FromGitter> <abdllhygt> How can i use variable in `module`?
<FromGitter> <abdllhygt> My code: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b2f92f17d3bca737a059dfd]
<RX14> @abdllhygt are you trying to achieve `Zenity.title("foo")` or `include Zenity` in an object then call `title("foo")` on the instance?
<FromGitter> <abdllhygt> I want to use local variables in `def`s ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b2f96ba0168e70c08ea3853]
<FromGitter> <abdllhygt> error: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b2f96f5479ca266897b1ce3]
<FromGitter> <j8r> @abdllhygt use a class/struct instead
<lvmbdv> yeah, there are no "static" (think C) variables for methods, a conscious design choice for OOP
<lvmbdv> it seems you want Zenity to be a class maybe
<FromGitter> <j8r> or use constants in the module
<FromGitter> <abdllhygt> @j8r thanks
<lvmbdv> yeah but constants are *constant* you can't redefine them afaik
<FromGitter> <j8r> yes
<FromGitter> <funny-falcon> LLVM has "count leading zeroes" and "count trailing zeros" instructions. Should Crystal have intrinsics for them? Crystal already have popcount intrinsics.
<FromGitter> <asterite> If you need them for the standard library, they can probably go into the Intrinsics lib, and eventually, if needed, added to Int
<RX14> we have Int#popcount
<FromGitter> <asterite> I'm using sublime text for Crystal and it works really well. Never had an issue with it (maybe because I don't write macros :-P)
<RX14> i don't see why not add them to int
<FromGitter> <asterite> OK
<Yxhuvud> I'd certainly use llvm-clz immediately if they were easily available.
rohitpaulk has joined #crystal-lang
<Yxhuvud> is it possible to add bindings in a third party lib or do they have to be part of the compiler?
<FromGitter> <j8r> You can have a shard providing them
<FromGitter> <funny-falcon> @j8r is shard allowed to extend intrinsics ? which way?
<FromGitter> <j8r> I don't know about intrinsics, but you add bindings to LLVM in a shard like this https://github.com/ysbaddaden/clang.cr for clang
<FromGitter> <j8r> you can also monkey patch the stdlib's `Int` or whatever object to add methods to it
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <codenoid> based on @Daniel-Worrall answer
<FromGitter> <codenoid> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b2fa72a7d3bca737a05c042]
<FromGitter> <codenoid> how i can make, minimum value of number in arr is 20
<FromGitter> <codenoid> but, yeah, rand(number-n) is random
<FromGitter> <confact> I can't get xpath work on xml node suddenly. I am trying to do `xml_data.xpath_node("//playlist/trackList/track/title")` on this small xml: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b2fa9fcd2abe4668886099f]
<FromGitter> <confact> it parse it without issues. but cant get xpath to work.
<FromGitter> <Daniel-Worrall> @codenoid that code doesn't work
<FromGitter> <Daniel-Worrall> and you'll most likely get out of bounds
<FromGitter> <codenoid> i have another ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b2fad1b0168e70c08ea606e]
<FromGitter> <codenoid> but it;s not the point
That_Guy_Anon has quit [Quit: Leaving]
<FromGitter> <Daniel-Worrall> my buddy came up with this https://carc.in/#/r/4dgj
<FromGitter> <Daniel-Worrall> actually https://carc.in/#/r/4dgk ⏎ (I adapted his code)
<FromGitter> <codenoid> oh cool https://carc.in/#/r/4dgj @Daniel-Worrall
<FromGitter> <asterite> Maybe ptr.value.@a
<FromGitter> <asterite> For Intrinsics, just reopen https://github.com/crystal-lang/crystal/blob/master/src/intrinsics.cr
<FromGitter> <faustinoaq> > I'm using sublime text for Crystal and it works really well ⏎ ⏎ @asterite Oh nice!, can you review these PR then https://github.com/crystal-lang-tools/sublime-crystal/pulls 😅
<FromGitter> <asterite> No time, sorry
<FromGitter> <faustinoaq> @asterite Hehe, no problem 😅 👍
faustinoaq has joined #crystal-lang
<FromGitter> <asterite> Yay Japan! :-P
<faustinoaq> @asterite Are you in Japan?
<FromGitter> <asterite> No, they just scored against Senegal
<FromGitter> <j8r> How can I use `Crystal.format` in a spec?
<FromGitter> <j8r> I would like to check if proper crystal code (bindings here) are generated
<FromGitter> <asterite> require compiler crystal s
<FromGitter> <asterite> Well, there's a require. But better to format code instead of checking that it's formatted
<FromGitter> <reiswindy> @confact https://carc.in/#/r/4dif Seems you need to add the namespace.
<FromGitter> <reiswindy> ```code paste, see link```
<FromGitter> <j8r> @asterite Just a way to know if a generated crystal is valid, sort of. The generator should ideally generate pre formated code, but it may be not valid. could you be clearer about the `require`?
<FromGitter> <asterite> I think compiler crystal syntax, or formatter. Check the crystal repo
<FromGitter> <asterite> Check the samples too, there's a sample that shows exactly that
<FromGitter> <j8r> ok thanks i will check out this
rohitpaulk has joined #crystal-lang
<faustinoaq> @asterite Oh ok :)
faustinoaq has quit [Quit: IRC client terminated!]
That_Guy_Anon has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter> <funny-falcon> I have a shock: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ WTF? [https://gitter.im/crystal-lang/crystal?at=5b2fddb2aeb8fa0c073e6098]
<FromGitter> <asterite> What's wrong?
<FromGitter> <funny-falcon> 1 / 128 == 128 ???
<FromGitter> <funny-falcon> 1 & 127 == 0 ???
<FromGitter> <asterite> Do you need all that code to show wrong behaviour?
wontruefree has joined #crystal-lang
<FromGitter> <confact> thanks @reiswindy, i tried to set the namespace on the node before xpath as a test but didn't work. Yours example did though so thanks again :)
<FromGitter> <mjago> What he said ~ who bothered to look at your code.
<FromGitter> <funny-falcon> @asterite I've already reduced larger code. ⏎ Here is a bit simpler version and comparison of runtime and compile time versions: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b2fe39f479ca266897ba7b6]
<FromGitter> <asterite> Then maybe use runtime loop :-P
<FromGitter> <asterite> What's the output of {{debug}} at the end of the macro?
<Yxhuvud> filing an issue in the tracker may also be a good idea.
ua_ has joined #crystal-lang
<FromGitter> <funny-falcon> @asterite unfortunately runtime loop makes code 10 times slower.
<FromGitter> <funny-falcon> @yxhuvud https://github.com/crystal-lang/crystal/issues/6254
<FromGitter> <j8r> haha funny title @funny-falcon 😆
<FromGitter> <funny-falcon> @asterite I've tried to reduce it further, but looks like it is minimal example.
<FromGitter> <asterite> You are overwriting i, I think
<FromGitter> <funny-falcon> @asterite 1 / 128 == 128 ? that is what code shows
ua has quit [Ping timeout: 240 seconds]
<FromGitter> <asterite> I'll try it later at home
<RX14> >> (1 / 128)
<DeBot> RX14: # => 0 - https://carc.in/#/r/4djl
<FromGitter> <asterite> I think I know the problem
<FromGitter> <asterite> Then precedence rules apply and change semantic
<FromGitter> <asterite> Just put parentheses around {{sz}} and I'm sure it will work
<RX14> >> (1 / 1<<7)
<DeBot> RX14: # => 128 - https://carc.in/#/r/4djn
<RX14> yep
<RX14> @funny-falcon
<RX14> shouldnt we be bracketing macro expansions @asterite ?
<FromGitter> <funny-falcon> @RX14 you are right, that is the reason
<RX14> an expressions should probably always have ()
<FromGitter> <asterite> RX14 no
<FromGitter> <asterite> Pasting stuff isn't always isolated expressions
<RX14> yeah
<RX14> well
<RX14> i'm struggling to think of somewhere where this isn't good
<FromGitter> <funny-falcon> @asterite , but it is super contrintuitive . That why we need to always bracketting macrosses in C , and it is very annoying.
<RX14> pasting an assign or a while shouldnt have brackets, but just expressions should
<FromGitter> <funny-falcon> I really thought 1<<7 were constant-folded before pasting.
<RX14> no
<FromGitter> <funny-falcon> Why?
<RX14> we dont constant fold
<RX14> thats for llvm
<RX14> what if you overrode <<
<FromGitter> <asterite> Someone should really build mind reading module into crystal. Then everyone will be happy
<FromGitter> <funny-falcon> Should I close https://github.com/crystal-lang/crystal/issues/6254 or lets remain it open?
<FromGitter> <asterite> 128
<FromGitter> <asterite> And more obvious
<FromGitter> <asterite> Or is it 64?
<FromGitter> <funny-falcon> Problem is not "shorter constant" or not. There is also 1<<23 in the actual code.
<FromGitter> <funny-falcon> Problem is macroses convenience.
<FromGitter> <asterite> Problem is always macros
<RX14> and if we deleted macros the problem would always be something else
<FromGitter> <asterite> Actually, I don't use Crystal, so I have no problems at all :-P
<RX14> there's always problems
<FromGitter> <j8r> macros are awesome :)
<FromGitter> <asterite> You can just copy and paste
<RX14> macros aren't awesome
<RX14> but they're neccesary
<FromGitter> <asterite> Also, problem was solved, use parentheses
<RX14> we should be able to auto parenthesize this
<RX14> we just need to figure out how
<FromGitter> <j8r> i like them, they are as powerful as they are capricious
<FromGitter> <mjago> Public macros should be suspected and discouraged
<FromGitter> <asterite> Sure, every little problem needs a language change
<FromGitter> <j8r> or docs explaining the expected behavior
<FromGitter> <asterite> To me it's intuitive. Macros paste stuff. They are like templates. I noticed the problem from my cellphone.
<RX14> okay, but if the solution is just "add parens around everything" then surely thats wasted effort
<RX14> and we should think about ways to remove that
<RX14> sure it makes sense, doesn't mean we have to deal with it
<FromGitter> <asterite> I also asked to show debug output. Then it would have been more obvious
<FromGitter> <asterite> If you write that code without macros, using shift, the problem is obvious. Macros obfuscate code, that's all
<FromGitter> <asterite> Or, well, send a PR to add parens. I'm sure it's an impossible problem
<RX14> why are you so sure?
<RX14> what about simply if you call to_s on a call to an operator, surround with parens
<RX14> (on the top-level only)
<FromGitter> <asterite> Gotta go (forever
<FromGitter> <funny-falcon> any way, thank you both
<FromGitter> <mjago> To get to 1.0 you can't deal with people reconfiguring the ast and expect it to work.
<FromGitter> <mjago> And you can do it in Crystal anyway
jfontan0 has joined #crystal-lang
<FromGitter> <wontruefree> puts event_id.inspectnew_event_id = event_id.to_i
<FromGitter> <wontruefree> puts event_id.inspectnew_event_id = event_id.to_i
jfontan has quit [Quit: The Lounge - https://thelounge.github.io]
<FromGitter> <mjago> > > puts event_id.inspectnew_event_id = event_id.to_i
jfontan0 has quit [Client Quit]
<FromGitter> <wontruefree> also I am not use to gitter so sorry for the spam
jfontan0 has joined #crystal-lang
<RX14> 862724863921578 is bigger than Inr32::MAX
<RX14> >> Int32::MAX
<DeBot> RX14: # => 2147483647 - https://carc.in/#/r/4djs
<RX14> >> Int64::MAX
<DeBot> RX14: # => 9223372036854775807_i64 - https://carc.in/#/r/4djt
<FromGitter> <wontruefree> awesome that works
return0e has quit [Read error: Connection reset by peer]
<FromGitter> <wontruefree> RX14 thanks! I was parsing ids and I guess the remote service increased there id size
return0e has joined #crystal-lang
<RX14> do you need to parse IDs?
<RX14> a common thing to do is just store the id as a string
<FromGitter> <wontruefree> I am putting into another database that expects strings
<FromGitter> <wontruefree> I mean that also does not seem nessisary but I think it was the default so it made it in
wontruefree has quit [Ping timeout: 264 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
<FromGitter> <codingconcepts> Hey all, I’ve a general question RE the parallelism branch and the roadmap
<FromGitter> <codingconcepts> Sorry, I blame the shitting mobile experience for sending that early! It looks as though the last commit to that branch was a year ago, is this being worked on in a different branch?
<oprypin> codingconcepts, was kinda abandoned, now it's back to planning stage
<FromGitter> <bararchy> @codingconcepts the last branch is singlemsq, and that hasn't been touched either, @bcardiff is planning on how to tackle this thing
<oprypin> codingconcepts, recent Q&A video https://youtu.be/wGQ8QqAqHOE?t=20m6s
<FromGitter> <codingconcepts> Brilliant, thanks guys. Glad to hear things are still on-track! I’ll have a look at that video!
<FromGitter> <codingconcepts> Being a full-time Go dev, the idea of being abstracted away and remaining ignorant of the OS thread multiplexing in Crystal sounds perfect. Keeping parallelism as slick as the language.
That_Guy_Anon has quit [Remote host closed the connection]
That_Guy_Anon has joined #crystal-lang
faustinoaq has joined #crystal-lang
<lvmbdv> can't wait to have actual parallelism tho
<faustinoaq> Oh, the new version banner on crystal website looks nice :)
<faustinoaq> Also the `HTTP:Server` example is updated, yay! :)
thews has quit [Ping timeout: 255 seconds]
That_Guy_Anon has left #crystal-lang ["Leaving"]
<lvmbdv> what's the difference between BigFloat and BigDecimal, on surface level?
<faustinoaq> Crystal is almost as fast as openresty :)
<faustinoaq> Oh, and my machine specs are pretty bad ;-)
<faustinoaq> ^^ Intel Celeron 2975U at 1.4GHz
<lvmbdv> CELERON?
<lvmbdv> why
<lvmbdv> IBM thinkpad T something?
<faustinoaq> Yeah, It's cheap :)
<faustinoaq> Just 200 $ :)
<RX14> ouch
<FromGitter> <bew> Ouch?
<faustinoaq> (the cheapest model: Intel Celeron, 2GB RAM, Ubuntu)
<FromGitter> <sdzyba> regarding macros discussion above: it's weird to see that golang doesn't have macros although it's ok generate code all around the place. crystal does have macros (which I consider to be an advanced version of code generation) but some people tend to hate them. I just don't understand that.
<faustinoaq> @sdzyba golang is a simple language
thews has joined #crystal-lang
thews has joined #crystal-lang
thews has quit [Changing host]
<faustinoaq> Maybe that's why golang compiles so fast ;)
<FromGitter> <sdzyba> I meant macros usage in development, not compilation time issues
<faustinoaq> @sdzyba Macros are like an interpreted language executed at compile time, so if you overuse them, then you can get pretty slow compilation times
<lvmbdv> crystal macros are *too* good imo, stateful macros are the devil's work
<faustinoaq> In fact macros doesn't care about types: https://gist.github.com/faustinoaq/20c12653130282971ba8102d9e60c5c9
<FromGitter> <sdzyba> I was just comparing macros to code generation in golang. these are similar in the goals they solve
<faustinoaq> @sdzyba Oh ok, I don't know much about golang, but your comment seems interesting +1
<FromGitter> <j8r> They seems less porweful/easy than macro – but I don't know much about them
<FromGitter> <j8r> Can we have templates that generate templates that generates templates recurisvely in Go like macros?
<FromGitter> <j8r> The good point with macros is we can build a very clean and powerful abstraction, but this adds complexity for debuging :/
jfo_test has quit [Ping timeout: 256 seconds]
<FromGitter> <sdzyba> there are no code generation tool in golang. people just use regular templates and generate code similar to how you generate some text information.
<FromGitter> <sdzyba> and it's absolutely ok to do that in golang, although it's neither a part of the language, nor it's stdlib. ⏎ so it feels a bit ugly to be honest.
<FromGitter> <sdzyba> and macros are a breath of fresh air
<FromGitter> <sdzyba> and it's absolutely convinient to have them in Crystal
jfontan0 is now known as jfontan
<FromGitter> <j8r> Thanks for the explanations @sdzyba 😃
spencer has joined #crystal-lang
<spencer> I've got a couple of crystal related questions if anyone has a second
<spencer> 1. Would anyone be interested in a code analyzer for automated documentation, possibly performance pain points? I'm trying to come up with a good first crystal project to get my feet wet and thought that might be helpful to some people
<spencer> 2. Anyone know anything about oepnssl errors in crystal?
rohitpaulk has joined #crystal-lang
<faustinoaq> spencer, 1. Would be nice, have you seen Scry and Ameba? https://github.com/crystal-lang-tools/scry && https://github.com/veelenga/ameba
<faustinoaq> spencer, What openssl errors? Are you on macOS? if so, check https://github.com/crystal-lang/crystal/issues/6231
<spencer> yep macos, I'll check that out
duane has joined #crystal-lang
<spencer> scry and ameba seem helpful but not quite what I was thinking of if I'm understanding them correctly
lvmbdv1 has quit [Quit: WeeChat 2.0.1]
<spencer> I was thinking of something that would go through and pull out comments, functions, variables, etc and make some skeleton documentation
rohitpaulk has quit [Ping timeout: 256 seconds]
<spencer> Possibly grab call hierarchies for each function
<spencer> faustinoaq here's my error, not sure if it's a crystal issue or an openssl issue https://pastebin.com/vt68UQS3
lvmbdv has quit [Quit: Leaving.]
<faustinoaq> spencer, Yeah I have seen that before, try https://gitter.im/crystal-lang/crystal?at=5b2eda6baeb8fa0c073cc036
faustinoaq has quit [Quit: IRC client terminated!]
<spencer> faustinoaq thanks man that worked