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
<FromGitter> <TeddyDD> ok, I figured it out, thanks for explanations @j8r @bew
DTZUZO has joined #crystal-lang
Heaven31415 has joined #crystal-lang
<Heaven31415> hi
<FromGitter> <Blacksmoke16> o/
<FromGitter> <Blacksmoke16> How would json mapping work if there arent any keys, i.e. just an array of values
<FromGitter> <Blacksmoke16> prob have to use a converter
<FromGitter> <asterite> Array(...).from_json("...")
<FromGitter> <Blacksmoke16> was thinking that would apply it to a class instance var, prob need a converter to do that im thinking
<FromGitter> <Timbus> I think he means for like, compacted data structures that use positions instead of key names
<FromGitter> <Timbus> beaten as i was typing it
<FromGitter> <Timbus> Although in an ideal world youd hopefully use protobufs or something, at that point
<FromGitter> <Blacksmoke16> more so like say i have a class called whatever, with a property called `ids`
<FromGitter> <Blacksmoke16> that i want to set from the response of the json from an http request
* FromGitter * Blacksmoke16 really need to figure out how to use pull parses
<FromGitter> <Blacksmoke16> in theory think i could do something like https://play.crystal-lang.org/#/r/4wu6 but hmm
<FromGitter> <Blacksmoke16> but think its looking for an object when it gets an array, even if a plain array is valid json
<FromGitter> <Blacksmoke16> or if not could always just do `foo.ids = Array(Int32).from_json(response.body)` i suppose
<FromGitter> <codenoid> `undefined reference to `SSLv23_method'
<FromGitter> <codenoid> what @bajro17 , which company ?
<FromGitter> <codenoid> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b933aee550f8808f5799536]
<FromGitter> <Timbus> is that ssl 1.1? because I recall that being a removed function
<FromGitter> <Timbus> or was it just deprecated..
<FromGitter> <codenoid> `OpenSSL 1.0.2g 1 Mar 2016`
<FromGitter> <codenoid> btw i have same openssl version in my local computer
<FromGitter> <codenoid> and it's working fine
pabs has quit [Ping timeout: 252 seconds]
<FromGitter> <Timbus> Strange
<FromGitter> <codenoid> i'm trying to use docker from now
<FromGitter> <codenoid> lol
<FromGitter> <codenoid> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b934e21550f8808f579fad3]
<Heaven31415> what is docker for
<FromGitter> <codenoid> but it's work with sudo
<FromGitter> <codenoid> ok then
<FromGitter> <codenoid> `Docker is a computer program that performs operating-system-level virtualization, also known as "containerization`
<Heaven31415> what is operating-system level virtualization?
<FromGitter> <codenoid> just like virtual box
<FromGitter> <codenoid> but not virtual box
<Heaven31415> so what I can do with it?
<Heaven31415> run something on various oses at the same time?
<FromGitter> <codenoid> yes
<FromGitter> <codenoid> no, you can run your container in any OS (that support docker)
<FromGitter> <codenoid> in container, you can install OS / Application
<FromGitter> <codenoid> https://hub.docker.com/explore/
<Heaven31415> so docker is like cross-platform virtual box
<Heaven31415> so I can use any os in container on any real os?
<Heaven31415> supporting docker ofc
<FromGitter> <codenoid> yes
<Heaven31415> that's cool dude
<Heaven31415> and do I pay performance penalty just like with virtual box?
<FromGitter> <codenoid> by default, docker directly use our hardware (cpu, ram, etc)
<FromGitter> <codenoid> real ram size, real cpu size
<Heaven31415> I started reading help on their website
<Heaven31415> it looks like some kind of abstraction for group of programs
<Heaven31415> so you instead of developing x versions of your software, you just develop a container with this software
<Heaven31415> and you can deploy it wherever docker is supported?
<Heaven31415> is that the idea why ppl use it?
<FromGitter> <codenoid> yeah <3
<FromGitter> <codenoid> btw i just learn docker yesterday
<Heaven31415> I used it once to work with crystal lang book
<Heaven31415> so, what do you do with docker?
<FromGitter> <codenoid> for crystal project development
<FromGitter> <codenoid> dealing with os library etc
<Heaven31415> so you create docker containers?
<Heaven31415> what's the difference between container and image?
<FromGitter> <codenoid> i think
<FromGitter> <codenoid> docker image is OS
<FromGitter> <codenoid> and docker container laptop (with OS)
<FromGitter> <codenoid> *docker container is laptop/computer
<Heaven31415> okey
<FromGitter> <Blacksmoke16> a container is an instance of an image
<FromGitter> <Blacksmoke16> i.e. you could have a 3 containers of a mysql image
<FromGitter> <codenoid> yeah
<FromGitter> <codenoid> thats what i mean
<FromGitter> <Blacksmoke16> adding to what codenoid said, it basic allows you to develop self contained components of an application
<FromGitter> <Blacksmoke16> that are defined, useable anywhere docker is installed, and eases setup/teardown to dev work
<FromGitter> <Blacksmoke16> also keeps you from installing random shit on your own pc
<Heaven31415> so I don't have to care what machines do I use
<FromGitter> <Blacksmoke16> so if you mess something up you can just rm the container and start again
<FromGitter> <Blacksmoke16> in regards to OS using docker? docker is linux native
<Heaven31415> that's very convienent
<FromGitter> <Blacksmoke16> it *can* work on windows/mac but in those cases it runs a linux vm that runs docker
<Heaven31415> okay
<FromGitter> <Blacksmoke16> mhm
_whitelogger has joined #crystal-lang
Heaven31415 has quit [Quit: Leaving]
_whitelogger has joined #crystal-lang
<FromGitter> <newtonapple> Does anyone know how the double splat generic operator work? For example: https://github.com/crystal-lang/crystal/blob/391785249f66aaf5929b787b29810aeb4af0e1e8/src/named_tuple.cr#L36
<FromGitter> <newtonapple> I looked around and couldn't find any documentations on it.
<FromGitter> <newtonapple> And when I tried to compile something similar the compiler complains:
<FromGitter> <newtonapple> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b9372c6e481f854a688996f]
<FromGitter> <newtonapple> dropping the `**T` seems to work though.
<FromGitter> <codenoid> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b937690a04db554a7f4ed3b]
<FromGitter> <codenoid> nvm,
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
DTZUZO has quit [Ping timeout: 245 seconds]
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
Yxhuvud has quit [Remote host closed the connection]
Yxhuvud has joined #crystal-lang
<FromGitter> <bajro17> @codenoid it will be something like uber
<FromGitter> <vladfaust> @newtonapple `def self.new(**options : **T) forall T` would do things. `T` wull be available within a macro within the `def`
lvmbdv has quit [Quit: brb]
DTZUZO has joined #crystal-lang
lvmbdv has joined #crystal-lang
<FromGitter> <codenoid> or something like GOJEK :D @bajro17
<f1refly> I established a connection over tcp and got a socket. When i spawn a fiber that puts incoming messages in a channel, shouldn't that socket be blocking when i use .get on it?
<f1refly> Currently it just receives the first message and then exits my loop. I even set blocking to true explicitly
<oprypin> dont set blocking
<oprypin> show code
<f1refly> It looks like this: https://carc.in/#/r/4wvc
<oprypin> socket.gets is never valid to use
<f1refly> what should i use instead?
<oprypin> hm maybe too strong of a statement. this seems like a line based protocol so may be fine
<oprypin> i think you're not supposed to use the same socket object for both sending and receiving
<oprypin> no lol again don't mind me
<oprypin> this is all fine, i didn't realize that you're communicating with an actual server here
<FromGitter> <bajro17> hahah yes :)
<FromGitter> <bew> Do you have control on the server sending the xml?
<FromGitter> <bajro17> @codenoid you are also from Indonesia?
<FromGitter> <codenoid> yes, i'm indonesian
<f1refly> bew: I don't i'm trying to write a library implementing the xmpp standard
<f1refly> The examples for tcp sockets used the exact same contstruct, but they seem to assume that there's always content that the socket has to offer
<f1refly> I wandet to avoid periodic checking and was hoping i could use some kind of blocking mechanism instead
<FromGitter> <bajro17> Ashar?
<oprypin> f1refly, i would expect this to just work
<f1refly> I mean i would use `read`, but the xml streams vary heavily in length, so `gets` seemed like the right thing
<f1refly> I expected that, too
<f1refly> here is my actual functions, just in case theres something else going wrong https://carc.in/#/r/4wvl
<FromGitter> <bew> note: instead of doing `(XML.parse message).children.first` you can do `XML.parse(message).children.first`
<f1refly> noted, i'll change that
<FromGitter> <newtonapple> @vladfaust thanks, that works. but why doesn't the source here need `forall`? https://github.com/crystal-lang/crystal/blob/391785249f66aaf5929b787b29810aeb4af0e1e8/src/named_tuple.cr#L36
<oprypin> newtonapple, https://crystal-lang.org/api/0.26.1/NamedTuple.html it has T in the type signature
<oprypin> but i dont know where in code that's defined. could be compiler magic
<FromGitter> <bew> It's compiler magic
<FromGitter> <bew> Somewhere in `src/compiler/crystal/program.cr` (search for `types["NamedTuple"] =`)
<FromGitter> <bew> (i'm on the phone, can't easily link to specific lines)
<FromGitter> <drum445> anyone been looking at Go2?
<FromGitter> <bajro17> I lost my interest to go crystal is my new favorite
<FromGitter> <drum445> same here tbh
<FromGitter> <drum445> Lack of classes kind of got to me after a while
<FromGitter> <bajro17> you can use interface on almost same way
<FromGitter> <bajro17> but still I love how simple is crystal
<FromGitter> <bajro17> I do some scraping few min ago and put all to file
<FromGitter> <bajro17> File.write("nameoffile", value)
<FromGitter> <drum445> I see the benefits of the Go way but I agree Crystal's (Ruby syntax) simplicity is just great
<FromGitter> <drum445> Go is very verbose also
<FromGitter> <bajro17> then I need to append to this text
<FromGitter> <bajro17> File.write("foo",a , mode: "a")
<FromGitter> <bajro17> just add mode: "a" and done
<FromGitter> <drum445> yep, same as Python's file
<FromGitter> <drum445> w, r, a
<FromGitter> <bajro17> also on yt CodingPhase start make crystal tutorials I hope it will become most popular language in few months
<FromGitter> <drum445> good stuff, it has a long way to go before it can compete imo
<FromGitter> <drum445> are you on mac or linux?
<FromGitter> <bajro17> Linux Manjaro my favorite <3
<FromGitter> <drum445> ah nice, xfce?
<FromGitter> <bajro17> Deepin
<FromGitter> <drum445> cool
<FromGitter> <bajro17> I have one problem I'm so bad with regex
<FromGitter> <drum445> who isn't mate
<FromGitter> <bajro17> how to get all what come in " "
<FromGitter> <drum445> "I'd hate to see an irregular expression"
lvmbdv has quit [Ping timeout: 252 seconds]
<FromGitter> <bajro17> I try with this /"([^"]*)"/
<FromGitter> <bajro17> but dont work for me
<FromGitter> <bajro17> puts /#{b}/.match(%r("([^"\\]*(?:\\.[^"\\]*)*)"))
<FromGitter> <bajro17> I try like that
<FromGitter> <bajro17> Error in src/scrap.cr:35: instantiating 'Regex#match(Regex)' ⏎ ⏎ puts /#{b.to_s}/.match(%r("([^"\\]*(?:\\.[^"\\]*)*)")) ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/crystal-lang/crystal?at=5b93dcac7667e11554c2d601]
<FromGitter> <bajro17> ` ⏎ Error in src/scrap.cr:35: instantiating 'Regex#match(Regex)' ⏎ ⏎ puts /#{b.to_s}/.match(%r("([^"\\]*(?:\\.[^"\\]*)*)")) ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5b93dcc7cddb292dff42ee48]
<FromGitter> <bajro17> this is error it throw me
<FromGitter> <j8r> Why you do regex match regex?
<FromGitter> <j8r> You want a String match a regex I suppose?
<FromGitter> <j8r> I suppose you want `"mystring" =~ /someregex/`
<FromGitter> <j8r> or `"mystring".match /someregex/`
<FromGitter> <bajro17> b = File.read("foo") ⏎ ⏎ c = /#{b}/.match(%r("([^"\\]*(?:\\.[^"\\]*)*)"))
<FromGitter> <bajro17> fixed
<FromGitter> <bajro17> Thank you
<FromGitter> <bajro17> How to puts all match I get just first one
<FromGitter> <codenoid> actually, what you gonna do :/
<FromGitter> <bajro17> I just want clean my file to get only text what is between " "
<FromGitter> <codenoid> show the dirty file
<FromGitter> <bajro17> "/the-incredibles-2004", "/pan-2015", this first 2 movies
<FromGitter> <bajro17> and there is about about 10k other names
<FromGitter> <bajro17> I just try this for practice because I'm so bad with regex
<FromGitter> <codenoid> ```a = File.read("./file.txt") ⏎ a = a.gsub(%("), "") ⏎ a = a.split(",")``` ⏎ ⏎ am i right (for performance, etc) ? cc master [https://gitter.im/crystal-lang/crystal?at=5b93e6c233ebb72e37e9efcd]
<FromGitter> <codenoid> ugh, my internet not stable,
<FromGitter> <jrfondren> if a .csv has double quotes that aren't part of the data then they can probably have commas in them that you shouldn't split on
<FromGitter> <jrfondren> well if it's just for practice, you can look for "([^"]+)" in the data and print out any lines you weren't able to handle
<FromGitter> <codenoid> i think, what inside quote is uri part
<FromGitter> <jrfondren> oh a slug? that's probably fine then
<FromGitter> <codenoid> yes, he do scraping
<f1refly> I fiddled around with the socket some more and it still doesn't work. when i use `socket.gets` and print the output it returns nil. what makes .gets wait when it isn't nil?
<FromGitter> <jrfondren> try socket.blocking=true
<f1refly> already did that without any effect whatsoever
<FromGitter> <jrfondren> the constructor also has a blocking flag
<f1refly> Also, when i check the socket it says it isn't closed
<f1refly> Ill try setting it in the constructor
<oprypin> it's not what you want, it just blocks other fibers
<oprypin> f1refly, make a runnable example that doesnt do what you expect
<FromGitter> <jrfondren> my minimal example is binding only to ipv6 :| I can't seem to get nc to connect to it. bizarre.
lvmbdv has joined #crystal-lang
<FromGitter> <jrfondren> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b93f15f7667e11554c34ce7]
<FromGitter> <jrfondren> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b93f178cddb292dff435bb8]
<FromGitter> <jrfondren> that all blocks by default.
<FromGitter> <jrfondren> or the server would spam while the client sleeps
sevensidedmarble has joined #crystal-lang
<f1refly> oprypin: basically this: https://carc.in/#/r/4wwh
<f1refly> but it won't run on carc, i guess because the networking is disabled in their sandbox
<FromGitter> <jrfondren> should you be calling somefunc there?
<f1refly> ah yes
<f1refly> with the socket and channel, before the final while loop
<f1refly> sorry
<FromGitter> <jrfondren> OK. that works for me, and is clearly blocking
<FromGitter> <jrfondren> after adding the call and changing it to point to localhost, and running 'nc -l -p 4000'. I can type <a>hi</a> into the server and that code prints it out
<FromGitter> <jrfondren> so the problem is that only the first message is printed? how are the messages separated?
<f1refly> I'll just strip down my existing code, seems simpler than rewriting it
<f1refly> The problem is that the loop exits after the first message
<FromGitter> <jrfondren> it prints both messages (correcting the </c> to </a>) and then waits for more when it connects to `printf '<a>test1</a>\n<a>test2</c>\n' | nc -C -l -p 4000`
<oprypin> f1refly, why do you have somefunc if it's never called....
<oprypin> oh that was addressed
<oprypin> it still doesnt do anything. ugh
<FromGitter> <jrfondren> with somefunc() called before the loop, and connecting to some service that emits XML, it reads and prints it out
<f1refly> Sorry for that, i'm still working on stripping my program down for you
<f1refly> It works when i use connect to localhost, but doesn't when i use the real server
<FromGitter> <jrfondren> oh that's a real server?
<FromGitter> <jrfondren> ok first thing I notice is that 'curl yourdata.forsale:5222' returns a message that doesn't end in CRLF, which your code needs
<FromGitter> <codenoid> is crystal will have coroutine ? xD https://github.com/ysbaddaden/muco
<f1refly> yourdata.forsale is running an xmpp server on 5222, the stream is not expected to end according to the specifications
<f1refly> It's just a very long tcp session where xml is exchanged from time to time. Noone specified any formatting whatsoever, so server implementations vary.
<f1refly> Most servers filter out any formatting to save resources
<f1refly> here's my stripped down code: https://carc.in/#/r/4wwu
<oprypin> ok but Error connecting to 'localhost:5000': Connection refused
<f1refly> try running `nc -l -p 5000` like jrfondren said
<f1refly> then you can send xml to it
<f1refly> the application expects a server running on 5000 for it to connect
<FromGitter> <jrfondren> hmm I bet the problem is the expectation that socket.gets always returns complete XML
<f1refly> But that isn't the issue, since it works marvellous with the local server
<oprypin> ok i did, it works
<FromGitter> <jrfondren> you could save and extend the message until it parses as valid XML
<FromGitter> <jrfondren> so that if, for networking reasons, you receive "<a>test" you can go on to receive "1</a>" and handle that
<oprypin> `gets` checks for newline specifically
<f1refly> But that shouldn't be an issue either. The xml fragmets (stanzas) that are sends are complete documents by themselfes and perfectly parsable
<oprypin> are they separated by newline?
<FromGitter> <jrfondren> that's a problem too, then
DTZUZO has quit [Ping timeout: 240 seconds]
<oprypin> and do they never contain a newline?
<f1refly> oprypin: They seem to be because gets successfully returns the answer to my first query
<f1refly> jrfondren: Why is that a problem? the socket shouldn't care what it puts through, i could work with broken xml
<FromGitter> <jrfondren> curl yourdata:5222 returns a message that doesn't end in CRLF (or LF), so I assume that's not to be expected
<FromGitter> <jrfondren> yourdata.forsale rather
<f1refly> Also the issue isn't that it can't seperate the messages, the issue is that it exits after the first one. gets returns nil and doesn't block for some reason, which cancels the loop
<oprypin> so why doesnt it happen locally?
<f1refly> i have no idea...
<oprypin> so maybe your expectations for that server are incorrecct
<FromGitter> <jrfondren> if your XML contains newlines, socket.gets will return before you get valid XML
<oprypin> yes
<oprypin> it's your server that's bailing on you
<f1refly> jrfondren: the server doesn't return anything when you don't ask it the right thing
<oprypin> or maybe not "your"
<FromGitter> <jrfondren> it returns an XML message that says "syntax error". that's not nothing :)
<oprypin> `gets` returns nil when the stream is closed
<f1refly> It's the spec thats bailing on me, since the server conforms to the spec
<oprypin> well sure,... then get a better understanding of the spec
<oprypin> we dont know the spec so we can only guess, thats not helpful
<f1refly> jrfondren: oh well, that's more than the server i had installed locally did. must be the configuration
<FromGitter> <jrfondren> hmm well, try stracing your client to see exactly what it's getting. look for recvfrom syscalls
<FromGitter> <nulty> Hi guys, is there a way to assert STDOUT in crystal specs? I've looked into mocking but the library I found is more than a year ago and doesn't seem to work with 0.25.1
<f1refly> oprypin: id save everything i can get from the socket and sort it out later, but that'd still be ugly without blocking
<oprypin> what do you mean without blocking
<oprypin> dont you see that it is blocking?
<oprypin> it blocks until the stream is closed or a line is received. nil means stream is closed
<oprypin> i assume that consequenct receives on the same socket also return nil
<f1refly> nulty: there is a way, but in my experience it's better to give the logger class a different io to write to
<f1refly> oprypin: hm, i haven't considered this. the stream shouldn't be closed but wait for my answer, so i didn't think about it closing
<f1refly> yes, every read returns nil
<f1refly> if i where to try and send more stuff into the socket and it doesn't throw an error that means it's still alive, right?
<FromGitter> <nulty> What do you mean f1frefly? How does the Logger class come into this?
<FromGitter> <nulty> Oh wait, I'm reading logger.cr now
<f1refly> you can define a custom io for testing with crystal spec, that's generally better than trying to redirect the normal io :)
DTZUZO has joined #crystal-lang
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
<FromGitter> <nulty> In the Formatter? Thats the only place in spec/ I can see the opportunity of setting a custom io
<oprypin> nulty, change your code to be able to write to something other than stdout
<oprypin> you're stuck thinking about ways how to change global behavior. the suggestion wasn't about changing it in a different way but about avoiding it
<f1refly> advice for your whole life :)
<oprypin> f1refly, i'm pretty sure that's the difference -- it's not that it's running locally, it's that the local server doesn't close the stream but the remote one does
<oprypin> i think it is indeed possible to close only one half of a socket, though it's strange to do it
<f1refly> But why would it? It should wait for more input...
<oprypin> maybe the message you sent doesnt indicate that you will send more afterwards
<oprypin> it's all about the spec
<f1refly> It totally does. It's the beginning of capability negotiations
<FromGitter> <nulty> You mean passing an io in my SUT? `MyThing.new(@io : IO = STDOUT)`
<oprypin> yea that's great
<FromGitter> <nulty> And read back whats in the custom IO buffer to assert the behaviour?
<oprypin> yes
<FromGitter> <nulty> Ok I'll go with this thanks
lvmbdv has quit [Ping timeout: 245 seconds]
_whitelogger has joined #crystal-lang
<FromGitter> <codenoid> it's weird
<FromGitter> <codenoid> kemal : ⏎ ⏎ ```post "/" do |env| ⏎ HTTP Parse ⏎ .. ⏎ .. ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5b94211667a666314ec2f6b0]
<FromGitter> <codenoid> kemal : ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b942137550f8808f57e9265]
<FromGitter> <codenoid> `Exception: Failed to parse multipart message: EOF reading delimiter (HTTP::Multipart::Error)`
<FromGitter> <codenoid> if spawn inside route
<FromGitter> <codenoid> weird
<FromGitter> <codenoid> what
<FromGitter> <codenoid> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b94224b67a666314ec2fb1b]
DTZUZO has quit [Ping timeout: 272 seconds]
<oprypin> gotta love Ruby tho
<oprypin> rand(2.1) == 0
<oprypin> rand(0) == 0.15263199395492888
<oprypin> cool cool
<FromGitter> <iSarCasm> Hello, can someone explain to me how macro works?
<FromGitter> <iSarCasm> Why this code works: ⏎ ⏎ ```[ ⏎ secp256k1 ⏎ ].each { |spec| sign_and_verify_spec(group) }``` ⏎ ⏎ where `sign_and_verify_spec` is a macro [https://gitter.im/crystal-lang/crystal?at=5b9434c533ebb72e37ebab6e]
<FromGitter> <nulty> Does this work? ⏎ ⏎ ```[ ⏎ :secp256k1 ⏎ ].each { |spec| sign_and_verify_spec(spec) }``` [https://gitter.im/crystal-lang/crystal?at=5b9435200fb4232e3895d0ff]
<FromGitter> <iSarCasm> it was a typo
<FromGitter> <nulty> i see
<FromGitter> <iSarCasm> The exact error is `no overload matches 'ECDSA.get_group' with type (ECDSA::Group | Symbol)`
<FromGitter> <iSarCasm> I clearly pass `Symbol` but somehow it gets `(ECDSA::Group | Symbol)`
<FromGitter> <nulty> Have you inspected the class of `group` withing the block?
<FromGitter> <iSarCasm> What you mean by inspected?
<FromGitter> <Blacksmoke16> like do `pp group.inspect`
<FromGitter> <iSarCasm> The macro is ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ where `ECDSA.get_group` is method expecting a `Symbol` [https://gitter.im/crystal-lang/crystal?at=5b94361b7667e11554c4d639]
<FromGitter> <Blacksmoke16> check where you are using it, the union of the two types would indicate that in one use of it you are passing it a symbol, while in another ECDSA::Group
<FromGitter> <iSarCasm> My array literally has only one element of symbol
<FromGitter> <iSarCasm> I tried tuple but same
<FromGitter> <Blacksmoke16> could try just typing it as Symbol, like `.as(Symbol)`
<FromGitter> <Blacksmoke16> otherwise, can you reproduce it easily on carc.in or something?
DTZUZO has joined #crystal-lang
<FromGitter> <iSarCasm> is group a keyword?
<oprypin> iSarCasm, where is the macro coming from?
<oprypin> this would be interesting to make a repro for
<FromGitter> <iSarCasm> Yep, reproduced
<FromGitter> <iSarCasm> The bug is somehow related to the name `group`
<FromGitter> <iSarCasm> I will try to reduce it and then link
<FromGitter> <Blacksmoke16> 👍
<oprypin> iSarCasm, where does this sign_and_verify_spec come from though!
<oprypin> iSarCasm, i think you dont need to report this, the macro itself is bad
<oprypin> it creates local variable `group`, the problem is not with the name itself
<FromGitter> <iSarCasm> @oprypin why is it bad?
<FromGitter> <iSarCasm> @oprypin macros should now use local variables?
<oprypin> they should not
<FromGitter> <iSarCasm> @oprypin I dont know how I would define specs dynamically then
<oprypin> sorry, it was not correct to say that macros shouldn't use local variables
<oprypin> just add safeguards for them
<FromGitter> <iSarCasm> @oprypin this makes sense
<oprypin> iSarCasm, further clarification https://bpaste.net/show/7a20e76a0b49
<FromGitter> <iSarCasm> Still isnt it strange? https://carc.in/#/r/4x16
<oprypin> it even expands what happens on the right
<FromGitter> <iSarCasm> Why it generates ⏎ ⏎ ```1.times do ⏎ obj = A.new obj ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5b943c8045318b2dfe7e4da3]
<oprypin> `obj = A.new obj` - no,, with that kind of code it's exactly appropriate behavior
<oprypin> because macros are literal substitution
<oprypin> i touched this subject in the link that i just sent
<oprypin> you passed `obj` as name, so `{{name}}` will be literally replaced with `obj`
<FromGitter> <iSarCasm> Ok I get it now
<FromGitter> <iSarCasm> Thanks
<FromGitter> <iSarCasm> For some reason I was sure it would be `obj = A.new :name`
<FromGitter> <iSarCasm> But I see why it happens now
<oprypin> so use `%obj = A.new({{name}})`
DTZUZO_ has joined #crystal-lang
DTZUZO has quit [Ping timeout: 240 seconds]
<FromGitter> <iSarCasm> @oprypin Nice PR btw
hightower2 has quit [Ping timeout: 245 seconds]
<FromGitter> <Blacksmoke16> anyone have any luck with using fibers for concurrent http requests
<FromGitter> <TeddyDD> Is there any way to compile Crystal program, and link only some libraries statically
DTZUZO has joined #crystal-lang
DTZUZO_ has quit [Ping timeout: 244 seconds]
_whitelogger has joined #crystal-lang
<FromGitter> <j8r> I think it's possible, but why not statically link all libs?
<FromGitter> <j8r> To do so I'm used to do it for each release in a Alpine Docker container