ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.2 | 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
PXBQPLshiner has joined #crystal-lang
PXBQPLshiner has quit [Remote host closed the connection]
<FromGitter> <girng> @bew oh wow, whats the double { syntax for?
<FromGitter> <girng> looks like damn sorcery , i like it !
<FromGitter> <bew> Just a macro expression
<FromGitter> <girng> wait, your using a macro?
<FromGitter> <girng> where is it defined or can it be done inline?
<FromGitter> <bew> Yes it's like a single line macro
<FromGitter> <girng> O_O
<FromGitter> <girng> @bew ohh i get it.. so the macro in {{}} literally "copies the code" doesn't pass by a reference (if used in a parameter)
<FromGitter> <girng> that's why it works for the mapping method
<FromGitter> <girng> if i gott hat right
<FromGitter> <bew> Yes you got it :)
<FromGitter> <girng> that's pretty cool / sneaky. i assume macros are pretty powerful??
<FromGitter> <girng> never heard of this feature in javascript or php
<RX14> There's a section in the docks on macros
<FromGitter> <girng> wow i really like the * with interpolating
<FromGitter> <girng> that's like the javascript spread operator??
<RX14> Yeah
<FromGitter> <girng> RX14 = :D
<FromGitter> <girng> if you go this video here (https://youtu.be/xbdVs4FhZac?t=1542), juan the man stated my exact reason why i like crystal
<FromGitter> <girng> "so you don't have to deal with callbacks in nodejs, you just have to write linear code" I LIKE THAT, a lot
DTZUZU has quit [Quit: WeeChat 1.9]
<FromGitter> <girng> wow, a person at 31:04 cut off juan, not nice!
DTZUZU has joined #crystal-lang
CNSOK1Korigan has joined #crystal-lang
CNSOK1Korigan has quit [Remote host closed the connection]
sz0 has quit [Quit: Connection closed for inactivity]
qard has joined #crystal-lang
themill890 has joined #crystal-lang
themill890 has quit [Remote host closed the connection]
<faustinoaq> Hey community, I just discovered something amazing, the UI (user interface) of [this](https://nikolamotor.com/nzt) VEHICLE is... written in Crystal!!!
<faustinoaq> ^^ This one \o/
<faustinoaq> ^^ That's the company where @elorest is working :)
<faustinoaq> ^^ A pretty nice use-case for crystal (embedded systems) +100
<FromGitter> <bew> that's pretty cool!! where did you did that it's in Crystal?
<FromGitter> <girng> how did they get crystal on the web? webassembly?
<FromGitter> <bew> where do you see "crystal on the web" @girng ?
<faustinoaq> @bew That vehicle is released by the company Nikola Motor, I don't work there but @elorest :)
<FromGitter> <girng> "the ui of this vehicle"
<FromGitter> <elorest> Can confirm.
<FromGitter> <bew> ✨
<FromGitter> <bew> @girng it's probably not web-based, is it @elorest ?
<FromGitter> <bew> or if it is, Crystal would be on the backend, not front end
<FromGitter> <elorest> @bew It’s a chromium app with crystal rendering the backend instead of node like with electron.
<FromGitter> <bararchy> @elorest really cool, what ui lib you use ?
<FromGitter> <elorest> It’s actually pretty fast even on arm.
<FromGitter> <elorest> We
<FromGitter> <girng> "crystal rendering the background", but how?
<FromGitter> <girng> with what
<FromGitter> <bew> backend, not background
<FromGitter> <girng> oh oops
<FromGitter> <girng> wow, fail
<faustinoaq> @girng I guess they can use crystal with a native UI as well, crystal is not only for web development ;)
<FromGitter> <girng> really interesting
<FromGitter> <elorest> It just boots straight up to xorg launching the chromium app with no desktop manager or display manager.
<FromGitter> <elorest> Only takes about 12 seconds but I think I can get that down further with a Yocto build.
<FromGitter> <girng> @faustinoaq how did u just randomly find that lol. nice one.
<faustinoaq> for most developers teams web development is easier and fast though ;)
<faustinoaq> @girng @elorest is a pretty nice guy, he is using https://amberframework.org in production +100
<faustinoaq> and because that thing makes me happy, right now I'm working on a bunch of nice features and fixes for amber, and I will publish some of them very soon ;)
<FromGitter> <elorest> :)
<FromGitter> <girng> :)
alex`` has joined #crystal-lang
<FromGitter> <unn4m3d> Ббюь
<FromGitter> <unn4m3d> Би юл до юбкой
<FromGitter> <unn4m3d> Sorry
qard has quit [Ping timeout: 264 seconds]
<FromGitter> <sdogruyol> Morning 👋
<FromGitter> <girng> morning!
<FromGitter> <Jens0512> Morning
<faustinoaq> Morning! 00:50 here ;)
<FromGitter> <Jens0512> Haha, still morning i guess :D
<FromGitter> <sdogruyol> 08:50 :)
<FromGitter> <sdogruyol> It's great to be in GMT timezone, literally the middle of the world in timezones 💃
<crystal-gh> [crystal] sdogruyol closed pull request #5866: Fix codegen/asm and codegen/sizeof specs (master...fix-codegen-specs) https://git.io/vx0It
<crystal-gh> [crystal] sdogruyol pushed 1 new commit to master: https://git.io/vxhqM
<crystal-gh> crystal/master 90c3a7a Johannes Müller: Refactor docs generator HTML scaffold (#5816)...
rohitpaulk has joined #crystal-lang
<travis-ci> crystal-lang/crystal#9df0315 (master - Fix codegen/asm and codegen/sizeof specs (#5866)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/365957765
<DeBot> https://github.com/crystal-lang/crystal/pull/5866 (Fix codegen/asm and codegen/sizeof specs)
<travis-ci> crystal-lang/crystal#90c3a7a (master - Refactor docs generator HTML scaffold (#5816)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/365958472
<DeBot> https://github.com/crystal-lang/crystal/pull/5816 (Refactor docs generator HTML scaffold)
alex`` has quit [Ping timeout: 264 seconds]
<17SAAZ78X> [crystal] sdogruyol pushed 1 new commit to master: https://git.io/vxhOs
<17SAAZ78X> crystal/master 68575de TSUYUSATO Kitsune: Improve Ctrl-C handling of spec (#5719)
<07EAA8E2F> [crystal] sdogruyol closed pull request #5719: Improve Ctrl-C handling of spec (master...fix/spec/improve-ctrl-c-handling) https://git.io/vA3nQ
<DeBot> https://github.com/crystal-lang/crystal/pull/5719 (Improve Ctrl-C handling of spec)
<DeBot> https://github.com/crystal-lang/crystal/pull/5719 (Improve Ctrl-C handling of spec)
<17SAAZ8CC> [crystal] sdogruyol pushed 1 new commit to master: https://git.io/vxhO0
<17SAAZ8CC> crystal/master 27cfeb3 Davor Ocelic: Minor: s/inlcude/include/ (#5378)
<07EAA8E4G> [crystal] sdogruyol closed pull request #5378: Minor: s/inlcude/include/ (master...master) https://git.io/vbzDm
<DeBot> https://github.com/crystal-lang/crystal/pull/5378 (Minor: s/inlcude/include/)
<DeBot> https://github.com/crystal-lang/crystal/pull/5378 (Minor: s/inlcude/include/)
<crystal-gh> [crystal] sdogruyol pushed 1 new commit to master: https://git.io/vxhOP
<crystal-gh> crystal/master 72ce28f Ata Kuyumcu: Fixed OpenSSL bindings to recognize LibreSSL (#5676)...
<crystal-gh> [crystal] sdogruyol closed pull request #5420: Parser: make an error on unbalanced end brace '}' in macro body (master...fix/crystal-parser/error-unbalanced-end-brace-in-macro) https://git.io/vbDlx
<FromGitter> <bararchy> Damn right @sdogruyol :)
flaviodesousa has joined #crystal-lang
<travis-ci> crystal-lang/crystal#68575de (master - Improve Ctrl-C handling of spec (#5719)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/365972513
<DeBot> https://github.com/crystal-lang/crystal/pull/5719 (Improve Ctrl-C handling of spec)
<travis-ci> crystal-lang/crystal#27cfeb3 (master - Minor: s/inlcude/include/ (#5378)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/365973875
<DeBot> https://github.com/crystal-lang/crystal/pull/5378 (Minor: s/inlcude/include/)
<travis-ci> crystal-lang/crystal#72ce28f (master - Fixed OpenSSL bindings to recognize LibreSSL (#5676)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/365975125
<DeBot> https://github.com/crystal-lang/crystal/pull/5676 (Fixed OpenSSL bindings to recognize LibreSSL)
<travis-ci> crystal-lang/crystal#403de68 (master - Parser: make an error on unbalanced end brace '}' in macro body (#5420)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/365976585
<DeBot> https://github.com/crystal-lang/crystal/pull/5420 (Parser: make an error on unbalanced end brace '}' in macro body)
alex`` has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.1]
rohitpaulk has quit [Ping timeout: 265 seconds]
rohitpaulk has joined #crystal-lang
That_Guy_Anon has joined #crystal-lang
<FromGitter> <jlebray> Hi, how can I link a static C library (*.a file) ? ⏎ Can I just @[Link(FILEPATH)] ?
<FromGitter> <PlayLights_twitter> Nop
rohitpaulk has quit [Ping timeout: 265 seconds]
<FromGitter> <j8r> @jlebray this can help you: https://github.com/crystal-lang/crystal_lib
<FromGitter> <jlebray> Thanks, I’ll give it a look
<FromGitter> <straight-shoota> @j8r that has nothing to do with dynamic vs. static linking
<FromGitter> <j8r> I've seen `@[Link(FILEPATH)] ` so maybe he would like to generate bindings too?
<FromGitter> <j8r> The difference is at compile time, you will need to add the `--static` to `crystal build`. else it will be dynamically linked
<FromGitter> <straight-shoota> sure, but either he knows about how to define the bindings in Crystal or you should point to https://crystal-lang.org/docs/syntax_and_semantics/c_bindings/
<FromGitter> <j8r> @straight-shoota you are right!
<FromGitter> <straight-shoota> @jlebray putting the .a file in lib path and adding `--static` to the compiler should do the trick, although static linking is not properly supported except on alpine linux
<crystal-gh> [crystal] sdogruyol closed pull request #5930: Raise syntax error when method argument name is keyword (master...fix/crystal/dont-use-invalid-internal-arg-name) https://git.io/vxQKZ
<FromGitter> <jlebray> @straight-shoota I see, thank you. I’ll cross my fingers then 😄
That_Guy_Anon has quit [Quit: Leaving]
leucos has joined #crystal-lang
<FromGitter> <cilquirm> Hi, i'm writing a little service that tries to connect to the GitHub API via HTTP client, and I keep getting this error: ⏎ `Exception: SSL_connect: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version (OpenSSL::SSL::Error)`
<travis-ci> crystal-lang/crystal#35a108e (master - Raise syntax error when method argument name is keyword (#5930)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/366088881
<DeBot> https://github.com/crystal-lang/crystal/pull/5930 (Raise syntax error when method argument name is keyword)
<FromGitter> <cilquirm> I'm using Crystal 0.24.2 via Homebrew and I believe it has something to do with the older version of OpenSSL on Mac OS X 10.12 ( which I'm on ), but not sure how to get past the error
<FromGitter> <straight-shoota> looks like #4618
<DeBot> https://github.com/crystal-lang/crystal/issues/4618 (OpenSSL Error: 1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version)
<FromGitter> <straight-shoota> installing openssl with homebrow should fix it
<FromGitter> <cilquirm> Thanks @straight-shoota . I did install OpenSSL via Homebrew but it would install `keg-only` despite pushing `--force` onto it, but the issue has a ton more clarity on it.
benharri has quit [Quit: The Lounge - https://thelounge.github.io]
benharri has joined #crystal-lang
alex`` has joined #crystal-lang
<RX14> @sdogruyol i see you're reviewing some issues on the repo now, I assume you're going to be helping review doc prs etc...
duane has quit [Ping timeout: 240 seconds]
<FromGitter> <sdogruyol> yup
<FromGitter> <sdogruyol> I'll be pinging you a lot 👍
hightower2 has joined #crystal-lang
snsei has joined #crystal-lang
hightower3 has quit [Ping timeout: 240 seconds]
duane has joined #crystal-lang
Jenz has joined #crystal-lang
<Jenz> Why the hell is this method
<Jenz> *
<Jenz> https://crystal-lang.org/api/0.24.1/ENV.html#fetch%28key%3AString%2C%26block%3AString-%3EString%3F%7CNoReturn%29-class-method
<Jenz> NoReturn
<Jenz> I really did try to type that in one message
<crystal-gh> [crystal] bcardiff pushed 1 new commit to master: https://git.io/vxhb4
<crystal-gh> crystal/master 24c5330 Carlos Donderis: Added documentation for Kernel#sprintf method (#5914)...
jxv has joined #crystal-lang
flaviodesousa has quit [Ping timeout: 240 seconds]
<FromGitter> <bew> @sdogruyol you're now a core member, is that new? Or did I missed sth?
<FromGitter> <DRVTiny> Hi4all! Who knows, is it planned to be fixed somehow or no? ⏎ x : UInt16 ⏎ x=7 ⏎ ⏎ 1) leads to exception (Crystal cant make "type inference" on constant "7" and thinks that 7 is Int32) [https://gitter.im/crystal-lang/crystal?at=5ad0c4dadf3e0fb547d3de6f]
<FromGitter> <sdogruyol> It's new @bew
<FromGitter> <DRVTiny> If x is UInt16, why crystal thinks that 7 on the right hand is Int32? It is very annoying and stupid IMHO
<FromGitter> <bew> That's cool, congrats @sdogruyol 🎉
<FromGitter> <sdogruyol> thank you 🙏
<FromGitter> <sdogruyol> @DRVTiny https://play.crystal-lang.org/#/r/3vap
<FromGitter> <sdogruyol> `7` as a literal itself is actually `Int32` and not `UInt16`
<FromGitter> <bew> @DRVTiny fwiw #2995
<FromGitter> <DRVTiny> literal is a literal - it is not Int32, UInt16 of Float64. If literal assigned to variable whose type is known - literal must be casted to the same type. ⏎ 7_u16 is crazy, absolutely awful think
<travis-ci> crystal-lang/crystal#24c5330 (master - Added documentation for Kernel#sprintf method (#5914)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/366135054
<DeBot> https://github.com/crystal-lang/crystal/pull/5914 (added documentation for Kernel#sprintf method (fixes #3124) )
<FromGitter> <sdogruyol> check the issue for more
<FromGitter> <DRVTiny> OK, thanks, already voted it!
<FromGitter> <bew> Jenz: it means that the block you pass to fetch should either return a String or not return at all (e.g: by raising an exception)
<FromGitter> <bew> The `NoReturn` is a special type, "returned" by `exit` or `raise` for example. It's not really returned, but the compiler need to know its type.
<FromGitter> <bew> Jenz: So for example if you have `a = rand(10) > 5 ? 1 : raise "error"` the type of `a` will be `Int32 | NoReturn`, and the compiler cab safely say that on the next lines, `a` can only be `Int32`. When doing `a + 1` later, the compiler will know that this line can only execute when `a` is `Int32`, as otherwise the raise would have interrupted the normal execution flow.
snsei has quit []
That_Guy_Anon has joined #crystal-lang
<FromGitter> <straight-shoota> hm, every method call can potentially raise, so `NoReturn` is usually implicit. It doesn't make sense to declare it explicitly, unless the method/block never returns.
<Jenz> I've never seen it used like that before
<Jenz> Only in `exit` I believe
<oprypin> that's not what NoReturn is
<oprypin> if you have `a = rand(10) > 5 ? 1 : raise "error"` the type of `a` will be `Int32`
<oprypin> thats it
<FromGitter> <straight-shoota> exactly
<FromGitter> <straight-shoota> `NoReturn` is never included in a union type
<FromGitter> <bew> Yes but implicitly noreturn will be there
<FromGitter> <straight-shoota> There is a PR pending to document this: https://github.com/crystal-lang/crystal-book/pull/235
<Jenz> Then why is https://crystal-lang.org/api/0.24.1/ENV.html#fetch%28key%3AString%2C%26block%3AString-%3EString%3F%7CNoReturn%29-class-method like it is
<FromGitter> <bew> I explicitly added it to explain
<oprypin> Jenz, no clue
<Jenz> Ok thanks :D
<Jenz> Gtg now
<FromGitter> <straight-shoota> `String | NoReturn` can be declared explicitly, but it doesn't make sense. It should be `String`.
Jenz has quit [Quit: leaving]
<FromGitter> <straight-shoota> And that block type is the only instance of this in the entire stdlib.
<oprypin> I suspect that this is invalid, yes
<oprypin> bew, with that type of explanation you may as well go adding NoReturn in every single case
<FromGitter> <bew> That's true, 'was trying to find a simple example to explain what is NoReturn, but yeah it does justify the need to write it anywhere
<FromGitter> <bew> Someone do a pr to remove it?
jxv has quit [Quit: string can snapped]
wuehlmaus has quit [Quit: Lost terminal]
<FromGitter> <codenoid> hi
<FromGitter> <codenoid> how i can change the content of a file
<FromGitter> <codenoid> without change the last modified date data
<FromGitter> <bew> Why not?
<FromGitter> <codenoid> bcoz i won't' change the last modified date
leucos has quit [Ping timeout: 245 seconds]
<FromGitter> <codenoid> helow
That_Guy_Anon has quit [Remote host closed the connection]
<FromGitter> <codenoid> sorry wrong place
<FromGitter> <bew> To change the content of a file you just open it for writing and write things to it (like an io)
<FromGitter> <bew> You cab also go to a specific position in the file to make your changes if you know where to go
<FromGitter> <bew> The last modified date is automatically set when you make changes to a file
<FromGitter> <bew> I don't think you can bypass that.
<FromGitter> <bew> You "could" set the modified date back yourself afterwards, but I don't see any valid use-case for this
wuehlmaus has joined #crystal-lang
faustinoaq has quit [Quit: IRC client terminated!]
guilleiguaran has joined #crystal-lang
<FromGitter> <codenoid> yes
<FromGitter> <codenoid> i just set last modified date
<FromGitter> <girng> good morning!
<crystal-gh> [crystal] RX14 closed pull request #5869: Add path to UNIXSocket created by UNIXServer (master...jm/fix/unix-server-path) https://git.io/vxEWx
<crystal-gh> [crystal] bew opened pull request #5945: Remove unnecessary NoReturn annotation (master...remove-unecessary-noreturn) https://git.io/vxjcR
<travis-ci> crystal-lang/crystal#9376982 (master - Add path to UNIXSocket created by UNIXServer (#5869)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/366218230
<DeBot> https://github.com/crystal-lang/crystal/pull/5869 (Add path to UNIXSocket created by UNIXServer)
<FromGitter> <girng> macros are awesome, help a ton with type definitions lol
<FromGitter> <girng> it's like i getto duplicate code O_o
<FromGitter> <j8r> yeah that's their purposes: avoid duplicate boilerplates
<FromGitter> <girng> that's perfect for me
<FromGitter> <girng> @j8r so, if you pass a NamedTuple literal through a parameter..
<FromGitter> <girng> someone said earlier it's passed by value right
<FromGitter> <j8r> that was @bew , yes
<FromGitter> <girng> so what's the difference between ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ad0f6bb7c3a01610ddd0d07]
<oprypin> i wouldn't say anything is passed by anything, you just give it a piece of code and `{{ }}` is "paste that piece of code"
<oprypin> just `a` is invalid because there is never any variable called `a`
<FromGitter> <girng> well, i was told Namedtuples are passed by value
<oprypin> what you pass to the macro is available only in macro context. the purpose of a macro is to generate code. generating code can't depend on runtime values
<FromGitter> <j8r> macro is at compile time, that's a different story with `def` etc
<FromGitter> <j8r> think macro generate valid "Crystal text code"
<FromGitter> <j8r> that will compile after being generated, like any code
<FromGitter> <bew> In your def example, the mapping macros receives `e` (literally) not the namedtuple (`{id: Int32}`)
<oprypin> girng, JSON.mapping is a macro that expects a literal. you passed "e" to it
<FromGitter> <girng> YES
<oprypin> [20:33:54] <oprypin> what you pass to the macro is available only in macro context. the purpose of a macro is to generate code. generating code can't depend on runtime values
<FromGitter> <bew> The mapping macros are expanded at compile time
<FromGitter> <girng> BUT E is a COPIED VALUE
<FromGitter> <girng> passed by Value!
<FromGitter> <bew> The namedtuple (with the def) is passed at runtime
<oprypin> I am out
<FromGitter> <bew> Compile time is before runtime
<FromGitter> <bew> Compile time is when you compile the program, runtime is when you execute the program
<FromGitter> <bew> They are different world, the macro world and the execution world are different
<FromGitter> <j8r> @girng if you wan't to dig how it works internaly, juste read the underlying code https://github.com/crystal-lang/crystal/blob/80a975cf0a98a4ce8464d0069145131667becd70/src/json/mapping.cr#L63 ;-)
<oprypin> start with `property` tho
<oprypin> actually no, that's also complicated
<FromGitter> <girng> i understand the difference between compile and runtime. i just don't understand why effect the parameter passing. especifally if the namedtuple is being passed by value (which is copying the data). in my mind, it's doing the exact same thing the macro is doing (copying the data)
<FromGitter> <girng> where it stems my confusion from
<FromGitter> <girng> but for other types that are generated on the heap / not passed by value, then i could understand because it's passed by reference
<FromGitter> <girng> and passing by reference is NOT copying the data. so macro would work / make sense to me
<FromGitter> <girng> hope that clears up where i'm coming from
<FromGitter> <bew> try to understand what is going on here https://carc.in/#/r/3vbi
<FromGitter> <ezrast> @girng macros are not methods and you do not pass variables to them, by value, reference, or otherwise. The arguments to macros are pieces of language syntax, devoid of context.
qard has joined #crystal-lang
<FromGitter> <ezrast> you can only access those arguments inside of `{{ }}` or `{% %}`
<FromGitter> <girng> @ezrast yeah understood. just not why my regular def method isn't (when it's essentially being passed a copied value). of which, the macro is being passed a copied value too.
<FromGitter> <bew> also, here I show what is going on in `macro_call`: https://carc.in/#/r/3vbl
<FromGitter> <j8r> macros just expand themselves whith what they have directly
<FromGitter> <j8r> If you "pass value to them from a class" - you can't, that's on runtime this!
<oprypin> no dude
<oprypin> just this https://carc.in/#/r/3vbp
<oprypin> all you need
<FromGitter> <ezrast> oh, because the `mapping` macros needs to know what your parameters are in order to expand correctly. Just passing it `e` doesn't give it that information.
<FromGitter> <ezrast> yeah, what oprypin said
<FromGitter> <bew> in your early example @girng you're passing `e` to the mapping, not the value of `e`
<FromGitter> <bew> yeah nice one oprypin
<FromGitter> <girng> okay i well i don't think i understand what pass by value means
<FromGitter> <girng> obviously i think it's doing something it doesn't
<FromGitter> <girng> from your examples, that's def not what i thought was happening
<FromGitter> <bew> value/reference thing is during runtime only
That_Guy_Anon has joined #crystal-lang
<FromGitter> <j8r> the `.mapping` are not casual methods, they are macros
<FromGitter> <j8r> that's why there are explanations about macros @girng
<FromGitter> <bew> having the crystal-expanded version of the code given in carc.in would help I think (self-promotion: #5821 ^^)
<DeBot> https://github.com/crystal-lang/crystal/issues/5821 (Add crystal-expanded & crystal-normalized emit options)
<FromGitter> <Sija> @gring in macros u don’t use `NamedTuple` type btw, it’s `NamedTupleLiteral`
<FromGitter> <girng> difference between namedtupleliteral and namedtuple?
<FromGitter> <Sija> literals are used in macros, like in your case as arguments passed to them
<FromGitter> <girng> could i pass a namedtupleliteral to the def method instead?
<FromGitter> <girng> or should i stick with macros?
<FromGitter> <Sija> that depends on your use case
<FromGitter> <girng> i'll stick to use macros, and use opyrin and julien, and bew's links as references
duane has quit [Ping timeout: 264 seconds]
<FromGitter> <girng> i think that's best for me
<FromGitter> <bew> checkout https://vimeo.com/190927958
<FromGitter> <bew> maybe something will click in your head while watching :)
<FromGitter> <ezrast> https://carc.in/#/r/3vbv
<oprypin> that's nice as well
<FromGitter> <girng> yeah....
<FromGitter> <girng> so. pass by value != "duplicating code"
<FromGitter> <girng> totally different. i see now
<FromGitter> <girng> thank you all.
<FromGitter> <styler1972> Quick question regarding JSON serialization
<FromGitter> <bew> welcome to macro world @girng :P
<FromGitter> <styler1972> do i need to implement ⏎ ⏎ def initialize(values) ⏎ # assign values here ⏎ end ... [https://gitter.im/crystal-lang/crystal?at=5ad102da5f188ccc1561acc2]
<FromGitter> <bew> yes... no... it depends, what are you trying to do?
<FromGitter> <ezrast> `JSON.mapping` defines a constructor for you but it takes a JSON parser as an argument; if you want to instantiate the class with values you provide yourself you'll need to define that constructor.
<FromGitter> <styler1972> because if i don't specify a constructor at all i get this: ⏎ ` ⏎ no overload matches 'MyClass.new' with type Hash(String, Bool | Bool::Null | Float32 | Float64 | Float::Null | Int16 | Int32 | Int64 | Int8 | Int::Null | String | String::Null | Time | Time::Null | UInt16 | UInt32 | UInt64 | UInt8) ⏎ Overloads are: ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5ad1039b080a3850532cacdb]
<oprypin> D:
<FromGitter> <ezrast> Did you... monkey patch `Bool`?
<FromGitter> <bew> @styler1972 how are you calling the constructor?
<FromGitter> <styler1972> through `.to_json`
<FromGitter> <styler1972> I did not monkey patch Bool, no
<FromGitter> <girng> do you have a JSON.mapping in your class?
<FromGitter> <ezrast> wth is a `Bool::Null`?
<FromGitter> <bew> show us some code @styler1972, because currently I don't understand what you're doing
<FromGitter> <girng> i've never seen that many types in an overload error and i've been around the block
<FromGitter> <Sija> @styler1972 without dedicated constructor you’d need to use `MyClass.from_json`
<FromGitter> <Sija> sth along the lines of `MyClass.from_json({ “foo” => “bar” }.to_json)` if you don’t want to build the json string by hand
<FromGitter> <styler1972> Ah that makes sense
<FromGitter> <styler1972> my code has a changed a bit since i originally asked
<FromGitter> <styler1972> i broke the json mappings out of my data model into a ui model
<FromGitter> <styler1972> im inheriting from ActiveRecord::Model, which might be doing strange things
<FromGitter> <styler1972> i do have a new question, but i asked on SO https://stackoverflow.com/questions/49824072/cant-infer-the-type-of-instance-variable-id-of-document
<FromGitter> <styler1972> let me know if that makes sense or if its a dumb question
<oprypin> styler1972, probably just need id : Int32
<FromGitter> <styler1972> for primary id?
<FromGitter> <styler1972> undefined constant ::ActiveRecord::Model::Fields::Int32 ⏎ :(
<oprypin> nevermind then
<FromGitter> <girng> i upvoted
<FromGitter> <styler1972> yeah that would have been ideal
alex`` has quit [Ping timeout: 256 seconds]
<FromGitter> <styler1972> btw.. i dont think i've ever been so giddy about programming as i have been in crystal.. love it so much. im learning it on a side project but i plan on using it for everything once i feel confident working in it as i do with other languages
<FromGitter> <Sija> yup, crystal is addictive (;
<FromGitter> <girng> @styler1972 praise
<FromGitter> <styler1972> actually i updated the SO post
<FromGitter> <styler1972> This makes no sense at all
<FromGitter> <styler1972> ``````
<FromGitter> <styler1972> It must be of type Int64, not Int64 is what i'm reading :/
<FromGitter> <ezrast> What it's saying is it must be of type Int64, not one of a bunch of different types that can't be narrowed down at compile time
<FromGitter> <styler1972> but isnt this explicitly saying the type should be In64?
<FromGitter> <styler1972> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ad10ef25d7286b43a28177a]
<FromGitter> <styler1972> Ah ok ok hold on
<FromGitter> <styler1972> im dense
<FromGitter> <bew> that works https://carc.in/#/r/3vc2
duane has joined #crystal-lang
<FromGitter> <styler1972> Anyone have a working example of using basic authorization using Crypto::Bcrypt ?
<oprypin> these have absolutely nothing in common
<FromGitter> <styler1972> yeah im using kemal so i was thinking about looking at the header with a before filter
Groogy2 has quit [Quit: WeeChat 2.1]
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qard has joined #crystal-lang
qard has quit [Client Quit]
qard has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 2 new commits to master: https://git.io/vxjX7
<crystal-gh> crystal/master 27f8b5d Ary Borenszweig: Merge pull request #5945 from bew/remove-unecessary-noreturn...
<crystal-gh> crystal/master de985d0 Benoit de Chezelles: Remove unnecessary NoReturn annotation
<travis-ci> crystal-lang/crystal#27f8b5d (master - Merge pull request #5945 from bew/remove-unecessary-noreturn): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/366322893
<DeBot> https://github.com/crystal-lang/crystal/pull/5945 (Remove unnecessary NoReturn annotation)
illy_ has joined #crystal-lang
ssvb has quit [Quit: Leaving]