ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.23.0 | Fund Crystal's development: | Paste > 3 lines of text to | GH: | Docs: | API: | Logs:
<FromGitter> <crisward> @sdogruyol should be working now. Finished the tests and have it running against a site on our dev server.
<Groogy> finally got archlinux up and running at home :D
A124 has quit [Read error: No route to host]
A124 has joined #crystal-lang
A124 has quit [Changing host]
A124 has joined #crystal-lang
_whitelogger has joined #crystal-lang
greengriminal has quit [Quit: Leaving]
<FromGitter> <jsilverMDX> does crystal have any HTML sanitization already?
onionhammer has quit [Quit: WeeChat 1.0.1]
onionhammer has joined #crystal-lang
ragmaanir has quit [Quit: Leaving]
<FromGitter> <jsilverMDX> its ```HTML.escape``` if anyone was wondering
<FromGitter> <codenoid> i'll update it
has-some-concern has joined #crystal-lang
<has-some-concern> Hi! Is the language on track to reach its yearly goals?
has-some-concern has quit [Quit: Page closed]
sz0 has quit [Quit: Connection closed for inactivity]
pwned has joined #crystal-lang
<pwned> hi, I'm looking for a shard that performs tasks similar to ruby/mechanize
hightower3 has joined #crystal-lang
<pwned> mechanize has a cookie session and dsl access to html elements like page.form.someinput = "42";
<pwned> it works faster than selenium if you don't need javascript, that's why I use it
hightower4 has quit [Ping timeout: 260 seconds]
<pwned> I guess I could just write those parts with plain HTTP::Client, but it is more work
<pwned> This package from Go looks similar, too
<FromGitter> <jsilverMDX> pwned: write it lol
<FromGitter> <jsilverMDX> the shards are pretty lacking in some areas. we need you!
tzekid has joined #crystal-lang
tzekid has quit [Ping timeout: 248 seconds]
<pwned> now it all makes sense
Philpax has joined #crystal-lang
FromGitter has quit [Remote host closed the connection]
oprypin has quit [Quit: Bye]
FromGitter has joined #crystal-lang
oprypin has joined #crystal-lang
<pwned> OK well I did this before in C++
<pwned> but it uses webdriver protocol
<pwned> this one uses curl and hcxselect to emulate what mechanize does
<pwned> so all I need is a curl wrapper and an html parser with css selector
Philpax has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
pwned has quit [Ping timeout: 260 seconds]
rohitpaulk has joined #crystal-lang
_whitelogger has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <sdogruyol> @pwned there you go and
hightower2 has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <sdogruyol> I think this is a good shards plugin
rohitpaulk has joined #crystal-lang
pwned has joined #crystal-lang
<FromGitter> <bararchy> Is there a way to integrate the Crystal formatter to vim ?
<FromGitter> <bew> I use
<FromGitter> <bew> and have mapped `<C-f>` to `:CrystalFormat`
<FromGitter> <bararchy> `E117: Unknown function: crystal_lang#format ` :(
<FromGitter> <bew> huh
<FromGitter> <bew> I have last version and it works for me
<FromGitter> <bararchy> I'll try to update
<FromGitter> <bew> 'k
<FromGitter> <bararchy> Nope, latest crystal-vim-git package in aur wont work :\
<FromGitter> <bararchy> Hm... seems to be broken ⏎ ⏎ ```code paste, see link``` []
<FromGitter> <bararchy> I guess installation is not full or something
<FromGitter> <bew> oh, I use some vim/neovim package manager, that get the plugin directly from github
<FromGitter> <bew> weird
<FromGitter> <bararchy> how do you do that ?
<FromGitter> <bararchy> what is it called ?
<FromGitter> <sdogruyol> hey everyone
<FromGitter> <sdogruyol> how are you
<FromGitter> <bew> Hey, fin u?
<FromGitter> <bew> I use:
<FromGitter> <bararchy> Hi @sdogruyol :) how was your talk ?
<FromGitter> <sdogruyol> @bararchy ıt's good, the feedback from the audience was great
<FromGitter> <sdogruyol> Great to see more people getting interested in Crystal
<Groogy> Hello!
<Papierkorb> Yo
<FromGitter> <sdogruyol> @Groogy hey!
<FromGitter> <sdogruyol> how's your new shiny PC? :D
<Groogy> It's great! :D THough I still emotionally see it as still my old one, didn't replace any part
<Groogy> yes I am sentimental about my computer
<FromGitter> <sdogruyol> haha
<Groogy> every part*
<FromGitter> <sdogruyol> you just reminded me of my youth and PC days
<FromGitter> <sdogruyol> I was kinda lunatic about pc parts
<Groogy> yeah, it was kind of fun nerdingt out for a week on what parts to pick out :P But now its time to finally get my first crystal project on github
<FromGitter> <bararchy> @bew Working now, thanks for the tip :)
<FromGitter> <sdogruyol> @Groogy yeah, it's a lot of fun back in the days
<FromGitter> <sdogruyol> did you get the new AMD Ryzen CPU?
<FromGitter> <bew> @bararchy glad it worked ;) Have fun!
<Groogy> Yepp I did, gonna be interesting to see how it goes when I really put stress on it
<FromGitter> <sdogruyol> great
<FromGitter> <sdogruyol> @Groogy what's your first Crystal project is about?
<Groogy> Contracts, the thing I talked about before. I'm too lazy to use specs, I like to inline the specis in the code instead :P
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
<Groogy> though question, I am trying to convert static macro data to some type I can retrospectively look at in runtime
<Groogy> but having some problems with that
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <bew> do you have an example?
<Groogy> eah give me a sec
<Groogy> the array is empty outside of finished while inside of finished it prints what I expect
<Groogy> also order of how things run seems to be all other code -> code generated by finished
<Groogy> doesn't seem to matter where finished is expanded
<oprypin> well that's the point, isnt it
<Groogy> yeah I thought it was just that it was a macro that got called last but it got expanded where it was written
<Groogy> hmm can I somehow define this statically so the compiler has to run this first?
<Groogy> oooh I got an idea, this should force the compiler to run this code first
<FromGitter> <bew> declare a constant
<Groogy> yeah what I was gonna do
<Groogy> a class constant for the class which I am also wrapping functions around
<Groogy> and the constant can then register itself with the global class runtime data constant
<Groogy> how do I do a spec that is "should raise"?
<Papierkorb> expect_raises(TheErrorClass) do do_something_that_raises end
<Groogy> nice thx
<Groogy> ow yeah for crystal-clear project name, crystal generates the module Crystal::Clear, should it be that or just simply CrystalClear?
<Papierkorb> Don't use ::Crystal
<Groogy> yeah thought that would be kind of bad
<Papierkorb> Avoid `crystal` if referring to the crystal language
<oprypin> huh weird
<Groogy> how you mean?
<oprypin> > for crystal-clear project name, crystal generates the module Crystal::Clear
<oprypin> just not a behavior i would expect, regardless of the actual name
<Papierkorb> foo-bar is Foo::Bar, foo_bar is FooBar
<oprypin> Groogy, i think you're just not supposed to put crystal- prefix even in project name, not just the namespace
<Groogy> should I go with instead of crystal-clear?
<Papierkorb> Groogy: That at least better describes what it is
<oprypin> i don't know
<Groogy> names I came up with was crystal-clear,, contractium
<Papierkorb> is the technology, a pattern, an external service, or similar, the origin of the word `crystal` in your project name, or is it referring to the language?
<Groogy> well just found it funny to be in the name as it is for crystal + "it is supposed to make things clearer" on what stuff do
<oprypin> Papierkorb, "crystal clear" is a phrase you say, you know
<Groogy> ^
<Papierkorb> oprypin: I know.
<oprypin> it's a decent name, you're just running into hurdles because there's no precedent naming things as crystal-something
<oprypin> people would name the repository like that, i like it, but in shard.yml you dont have crystal-
<Groogy> I'll jsut go with
<Groogy> there are a few projects actually called crystal-* though I think being clear in the name is worth more than some small pun :P
<oprypin> puns are the most important
<Papierkorb> Half my public projects have pun names, or reference names .. and all of my private ones lul
<Groogy> fack it I'll go with crystal clear xD I like that name
<Groogy> will see if it causes problems
<FromGitter> <bararchy> How can I generate all hex code from "\x00" to "\xff" "\x99" ?
<Papierkorb> What do you mean? Do you want iterate over 0..255, or do you want to iterate through the ASCII table?
<FromGitter> <bararchy> It's not all ASCII so no, I guess , is there a way to go from (0.255) to "\x**" ?
<Papierkorb> Do you mean the first 256 codepoints of unicode?
<oprypin> bararchy, what are you actually trying to do?
<FromGitter> <bararchy> I mean to create something like this array ⏎ ⏎ ```["\x00", "\x01", "\x02", "\xa0", "\xa1", etc...]``` []
<oprypin> but why?
<FromGitter> <bararchy> Exploit development ? :)
<FromGitter> <bararchy> for a fuzzer
<Papierkorb> I mean that's simple `(0..255).map(&.chr)`
<oprypin> "\xff" is nonsense, do you really want LATIN SMALL LETTER Y WITH DIAERESIS
<oprypin> why stop there, why not all unicode?
<FromGitter> <codenoid> soap
<FromGitter> <bararchy> ALL unicode is better
<FromGitter> <bararchy> what is the range though ? ⏎ also, "\x00" is not really unicoe right ? it's NULL or something
<FromGitter> <codenoid> *sup
<oprypin> Unicode defines a codespace of 1,114,112 code points in the range 0hex to 10FFFFhex
<oprypin> of those, 136,755 are actual characters at the moment. with varying gaps in between iirc
<oprypin> so are you looking to work with bytes or text?
<FromGitter> <bararchy> Bytes
<FromGitter> <bararchy> "\x00" is a null byte as far as i know
<Papierkorb> bararchy, you may want to look up how memory actually works
<oprypin> then you should know that "\xff" is represented as \xc3\xbf bytes
<Papierkorb> Or better, how data is represented
<FromGitter> <codenoid> what all \x** mean ?
<Papierkorb> as start, don't use Crystal for that. Use C.
<oprypin> wait what
<oprypin> codenoid, means take **th Unicode character
<FromGitter> <codenoid> ok
<FromGitter> <codenoid> like this ?
<FromGitter> <codenoid> in byte
<FromGitter> <codenoid> test 😆
<crystal-gh> [crystal] MakeNowJust opened pull request #4690: Format: fix to place only a newline between call-comment-newline and def (master...fix/crystal-format/4672-double-newlines-before-def)
<oprypin> bararchy, strings cannot hold arbitrary bytes. here's what's actually happening when you reach codepoints after 128 (scroll to bottom)
<oprypin> to work with bytes, you, well... work with `Bytes`
<FromGitter> <codenoid> C syntax hurt my eyes 😖
<oprypin> >> "\xff".bytesize
<DeBot> oprypin: # => 1 -
<oprypin> wait what
<Papierkorb> Did you mean? `\u{ff}`
<oprypin> well sure but uh why is it allowed to create invalid string literals
<oprypin> >> "\xff" == 0xff.chr
<DeBot> oprypin: # => false -
<FromGitter> <bararchy> oprypin: Thanks, your example was what I wanted :)
<oprypin> is true in Python
<Papierkorb> char vs string
<oprypin> bararchy, I don't think that arbitrary two-byte combinations are what you wanted. i was trying to show the opposite.
<Groogy> what is the inverse of expect_raises?
<oprypin> Groogy, literally nothing
<Papierkorb> Just calling the method
<Groogy> alright
<Papierkorb> If something raises, the spec fails
<FromGitter> <bararchy> Well, I just wanted to create an array of chars to create random strings for fuzzing
<FromGitter> <bararchy> like, all relevant chars
<Groogy> oh can you somehow magically escape expanded strings in macros?
<FromGitter> <codenoid> is byte size == bye length ?
pwned has quit [Ping timeout: 240 seconds]
<oprypin> Groogy, do you mean `.stringify`
<oprypin> codenoid, uh yes..?
<Groogy> eh no I am passing code to a macro, and I want upon failure to have that code in an exception message
<FromGitter> <codenoid> o
<Groogy> or maybe it is stringify
<oprypin> the problem here is Crystal allows ccreating invalid string literals. \x should not even be part of the language
<FromGitter> <codenoid> and, byte length used for ?, ,, i'm text plain background
<oprypin> >> {"я😍".size, "я😍".bytesize}
<DeBot> oprypin: # => {2, 6} -
<FromGitter> <codenoid> and, why you wrote the crystal syntax inside {% %} ?
<FromGitter> <codenoid> can i write that in anywhere place inside my cr file ?
<oprypin> codenoid, which part are you referring to? please don't be alarmed by the things you see on from the IRC bot
<oprypin> this is boilerplate to print the last expression. basically turns `{"я😍".size, "я😍".bytesize}` into `puts({"я😍".size, "я😍".bytesize}.inspect)` but in a really complicated way
<FromGitter> <codenoid> I never believed with the bridge bot, he could have edited his message
<FromGitter> <codenoid> ok
<FromGitter> <codenoid> what ** AST nodes ** ?
<FromGitter> <codenoid> thanks guru. i read it
<FromGitter> <codenoid> i got it
<FromGitter> <codenoid> is macro can have a parameter ?,
<FromGitter> <codenoid> hold on
<oprypin> codenoid, macro parameters can be accessed only in a macro context
<FromGitter> <codenoid> i do something wrong
<oprypin> macro context is only inside {% and {{
<oprypin> so you need {{s}}
<FromGitter> <codenoid> yasss
<oprypin> you would get that message without running the program. it's a compile-time `puts`
<FromGitter> <codenoid> and btw, i still confused about @string @@string,
<Groogy> is there a method in hash that let's me ensure that I get either object in the hash or a newly constructed object?
<Papierkorb> Groogy: You're looking for the default-value feature of Hash
<Groogy> working in constants so not sure if I can use that?
<Groogy> macros*
<Groogy> meh my macro will have to be extra ugly Iguess
<oprypin> Groogy, well one way i know is `(hsh[key] ||= [] of String) << "asdf"`
<Groogy> hmm
therubi has joined #crystal-lang
<therubi> cool
sagax has joined #crystal-lang
<Groogy> huh this is kind of cool, this implementation is going to be faster I think than my C++ variant. I.e more is done at compile time in comparison
therubi has quit [Read error: Connection reset by peer]
<Groogy> alright finally, the base is done :) time to write readme and examples
jihantoro has joined #crystal-lang
<Groogy> how do I check for th flag if release is set?
<oprypin> Groogy, {% if flag?(:release) %}
<Groogy> thanks
<Groogy> do the macro have any way to check if a constant has been defined?
jihantoro has quit [Read error: Connection reset by peer]
<oprypin> maaaaybe some really hacky way, i dont know
<FromGitter> <bararchy> @sdogruyol we are going to integrate cryload into our test env :)
<Groogy> are specs always run in release mode?
<FromGitter> <sdogruyol> @bararchy that's great to hear
<FromGitter> <sdogruyol> Is there anything that I can help you with
<oprypin> Groogy, i dont think so
<oprypin> if ever
<Groogy> hmm because if I removed a part of my code with a flag?(:release) then the spec couldn't run anymore
<Groogy> because of undefined constant
rohitpaulk has joined #crystal-lang
<oprypin> Groogy, how about you try it with {% if true %} instead
<Groogy> nah it works as expected
<Groogy> if I do run it with --release
<Groogy> the specs fails
<Groogy> (since the code it is validating is not run anymore)
<Groogy> so it just seems like the compiler can know "Hey this reference to this constant won't exist in release, so here's a compile error"
<Groogy> which is kind of cool
jihantoro has joined #crystal-lang
jihantoro has quit [Client Quit]
<Groogy> now I just need to do the boring part of writing usage examples
<FromGitter> <bararchy> @sdogruyol Maybe I'll PR you for some minor changes if I see something, else, it's perfect the way it is ;)
<FromGitter> <sdogruyol> awesome! :)
<FromGitter> <sdogruyol> thanks @bararchy
<FromGitter> <picatz> Does anyone know how to check if a socket ( raw ) connection has succeeded or failed?
<FromGitter> <bararchy> NP, thank you for written it
<oprypin> picatz, when you're dealing with sockets and what to check whether something has failed, the answer often is it's impossible
<FromGitter> <picatz> Not sure if that's even what I'm looking for exactly: but, essentially I'm looking to write a port scanner in crystal; and I'm having an interesting time of figuring out how to check if a socket connection succeeded. 😄
<oprypin> want*
<oprypin> picatz, there are so many pitfalls when doing a port scanner, probably dont wanna get into that :|
<oprypin> but yeah, if you try a connection and you get a "connection refused", isn't it supposed to raise an exception?
<FromGitter> <picatz> Well, the thing is, I do want to get into it. 😸
<FromGitter> <picatz> I'm not seeming to get a raised exception for what I'd assume would be a failed connection ( closed port ).
<oprypin> what will often happen is for "additional security" connections will succeed and hang indefinitely
<oprypin> are you trying this on localhost or perhaps on your internet router?
<FromGitter> <picatz> If this helps: more specifically ( without pimp'n out ma' blog too much ) : I'm trying to port my ruby port scanner to a crystal port scanner.
<FromGitter> <picatz> I'm trying on a remote host.
<oprypin> im getting Error connecting to 'localhost:1234': Connection refused
<FromGitter> <picatz> What code are you using, roughly?
<oprypin> same for a remote host
<FromGitter> <picatz> Ok, interesting. I wasn't using a TCPSocket; and I was actually just initializing a socket like : `s =, type, protocol, false)`
<FromGitter> <picatz> Then I did something like this:`addr ="ipaddresshere", port)`
<FromGitter> <picatz> and then finally `s.connect addr`
<FromGitter> <picatz> '\( ' o ')/' Do I need to use TCPSocket?
<oprypin> no idea, basically thats all i know
<FromGitter> <picatz> gotch'a. In ruby, I don't seem to need to specify a TCP socket type, at least from what I can tell. I'm not much of an expert on how that stuff works under the hood. 😅
<FromGitter> <picatz> TCPSocket does seem to get me where I want to go though.
<oprypin> except for the part where it doesnt scan UDP ports
<FromGitter> <picatz> So I'd need to have a separate TCP scan and UDP scan.
<FromGitter> <picatz> I wonder if a port scanner like nmap does TCP + UDP out of the box.
<FromGitter> <picatz> If I'm not mistaken ( too lazy to man page ) there's an option for something like that.
<FromGitter> <picatz> OH
<FromGitter> <picatz> OK
<FromGitter> <picatz> I read some documentation and figured something out I think.
<FromGitter> <picatz> `` --> `#Creating a TCP socket in a C-like manner ⏎ s = Socket::INET, Socket::SOCK_STREAM`
<FromGitter> <picatz> So, essentially in my port scanner from my blog post. I'm just setting up a TCP socket essentially.
<FromGitter> <picatz> 👏 Some learn'n.
<FromGitter> <picatz> Well, I've gotten a simple port scanner together. Thank you @oprypin for being there for me. 😄
<Groogy> aaaand done :D
<FromGitter> <picatz> Good shard name! ✨
<Groogy> :D
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter> <sdogruyol> @Groogy congrats
<Groogy> gonna write some more in the readme then I'll post on crystal reddit as well
<RX14> Groogy, yeah i'm not entirely sure i understand your example from reading the readme
<RX14> i'm confused about what the arguments to the macros means
<Groogy> hmm should make that clearer
<oprypin> Groogy, there are also some mismatches with function names
<Groogy> ah thx
<oprypin> between contract and immediately following function
<RX14> yeah i was wondering if that was intentional
<RX14> or not
<Groogy> git show about now?
<Groogy> how about now* accidentally wrote in wrong terminal
olbat has joined #crystal-lang
<oprypin> alrighty. anyone wanna proofread this before I drop it on the general population? :D
<Groogy> huh you didn't need a x server runnning?
<oprypin> it's actually running on Windows
<oprypin> can i clarify that somehow so people don't jump to the same conclusion?
<FromGitter> <picatz> 😎 Nice
<Groogy> yeah but for me to get it to work on windows with GLFW what I did was setup a windows x server
<Groogy> which then the application could connect with
<RX14> Groogy, SFML takes care of it ebcause it's built for windows
<Groogy> I know but so was GLFW
<RX14> well clearly not properly
<Groogy> or well right I built GLFW in ubuntu for windows
<RX14> yeah well then
<oprypin> well that's not Windows then
<FromGitter> <mverzilli> great article! "You can try out other examples just as well, though not all of them will work." => Is this because the examples themselves are broken or is it because they use some std features that we currently won't work on Windows?
<oprypin> mverzilli, one example happens to use libyaml and i guess nobody has tried it on windows yet, and another uses some math function that's not on windows
<RX14> "Install Crystal's dependencies" i'd clarify to build dependencies
<FromGitter> <picatz> I've put together that crystal port scanner to start working on my blog post. My implementation looks like this: -- Does anyone see any problems with this?
<oprypin> picatz, seems ok, but what's the top level spawn for?
<RX14> oprypin, --single-module is implied by --cross-compile
<RX14> and why --no-debug?
<RX14> i had sucess with debug into on crystal executables with a linker opt
<RX14> well, you can remove them if you want
<Groogy> aaand posted on reddit
<FromGitter> <picatz> @oprypin Without it, it will actually crash from what I can tell 😟
<RX14> oprypin, you could always use #4491
<DeBot> (Support windows linker)
tzekid has joined #crystal-lang
<oprypin> let's see how those flags play out
<RX14> oprypin, you should mention you need to restart the cmd terminal after installing cmake to apply the new PATH
<RX14> and obviously set %folder%
<oprypin> mm good point, thanks
<RX14> oprypin, you might be able to use cmake --build abstraction
<oprypin> thanks
<RX14> oprypin, also would be nice to center the bash/cmd text in the center of the page not the center of the element but thats just a blog css thing
<RX14> like div.code .name
<FromGitter> <picatz> It's seems like I can't iterate over a `Range` and `spawn` for my port scanner without first turning the `Range` into an `Array` with `.to_a`.
<oprypin> no-debug thing seems to be required. must be something txe messed with
<RX14> oprypin, what's the error?
<RX14> ok
<RX14> well then yes
<RX14> it's txe's alternate rescue transform
<oprypin> huh what do you know. turned `msbuild ALL_BUILD.vcxproj /p:Configuration=Release` into `cmake --build .`
<oprypin> thanks
<oprypin> nevermind, the /p:Configuration=Release part is important
<RX14> oprypin, i thought release was a cmake -D flag
<RX14> at least it is on some projects
<oprypin> well it probably wants to cater to proper visual studio usage, and it allows switching between debug and release freely
<Groogy> I believe
<FromGitter> <picatz> Is there any Fiber pool for Crystal?
<FromGitter> <picatz> Like, if someone's already made a nice abstraction; or would anyone even want/need such a thing?
<oprypin> picatz, the only use for it would be limiting the number of concurrent tasks
<oprypin> and that's not hard to do without a pool
<FromGitter> <picatz> I'd like to use a fiber pool to limit the amount of port scans ( open files / sockets ) open at one time.
tzekid has quit [Ping timeout: 240 seconds]
<FromGitter> <codenoid> hi,,
<FromGitter> <codenoid> what the fastest way to format my date in crystal, from 2017-07-09 23:00:11 to 9 July 2017
<Groogy> I'm guessing?
<FromGitter> <codenoid> fastest way from 2017-07-09 23:00:11 to 9 July 2017
<oprypin> figure out the format of the first string, figure out the 2nd format
<oprypin> `Time.parse(s1, format1).to_s(format2)
<FromGitter> <codenoid> nice
<oprypin> waitwhat i mean
<FromGitter> <picatz> Is there a `Queue` for Crystal?
<FromGitter> <picatz> Or, if I just pop stuff off an `Array`, I won't need to worry about my Fibers doing anything silly?
<oprypin> probably not for the purpose that you wnt
<FromGitter> <codenoid> thanks ^^
rohitpaulk has joined #crystal-lang
<FromGitter> <codenoid> is really your cat ? @picatz
<FromGitter> <picatz> Haha, no. Not my cat 😸
<FromGitter> <picatz> I wish tho
<FromGitter> <codenoid> oohho, ok ^^
<FromGitter> <picatz> It's a cool look'n cat with a nice look'n hat.
<oprypin> aaand posted on reddit
<FromGitter> <codenoid> nice article <3
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
fenicks has joined #crystal-lang
pwned has joined #crystal-lang
Groogy has quit [Quit: WeeChat 1.9]
<FromGitter> <jsilverMDX> @codenoid did you get my message in the amber gitter room
<hightower2> picatz: you probably want channels described here,
<pwned> [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
<FromGitter> <bew> pwned, the brackets are not properly balanced (too much `]` ), please try again
<oprypin> or not
<FromGitter> <bew> ^^
<pwned> I'm sorry, kid got the keyboard
<pwned> he's 2 year old and still can't code
Groogy has joined #crystal-lang
<pwned> although he can guide a turtle manually
<Groogy> exit
<Groogy> ops
Groogy has quit [Quit: WeeChat 1.9]
rohitpaulk has quit [Remote host closed the connection]
<crystal-gh> [crystal] bew opened pull request #4691: Do not exit `crystal init` when directory is the current directory (master...tool-init-allow-in-current-dir)
sp4rrow has joined #crystal-lang
<FromGitter> <jsilverMDX> pwned: cute lol
<crystal-gh> [crystal] bew opened pull request #4692: kernel: Refactor after_fork_child_callbacks, remove unnecessary nils (master...refactor-kernel-after-fork-callbacks)
<crystal-gh> [crystal] bew opened pull request #4693: fiber: visual code fixes (master...fiber-little-fixes-while-reading)
<crystal-gh> [crystal] bew closed pull request #4622: Various fixes (master...various-runtime-fixes)
sp4rrow has quit [Read error: Connection reset by peer]
sp4rrow_ has joined #crystal-lang
sp4rrow_ has quit [Client Quit]
<FromGitter> <crisward> Anyone know how I can test these - with the heroku buildpack? The buildpack currently curl's in the binaries from github.
<FromGitter> <sdogruyol> @pwned great kid!
Groogy has joined #crystal-lang
pwned has quit [Ping timeout: 240 seconds]
_whitelogger has joined #crystal-lang
<Groogy> do crystal have like specialization of generics?
<Papierkorb> It doesn't D:
<Groogy> aw man that would be great though :/
<Groogy> I like to move serialization of my objects to a seperate class which is easily identified by like something "Serialiser(ObjClass) serializer"
<Groogy> so my normal logic won't have bunch of serialization data in it
<FromGitter> <bew> there was discussion about it here:
<Papierkorb> Groogy: You don't need to do that. The way most serializers do it is to have an Object#to_stuff for the generic implementation, and then have a SpecialClass#to_stuff if needed, like for Int or Bool
<Papierkorb> Groogy: See JSON, YAML from the stdlib, my Cannon stuff does it like this too
<Groogy> I know but then that means my SpecialClass#to_stuff will be inside SpecialClass
<Groogy> I like to have a SerializerClassForSpecialClass instead
<Groogy> (not that long name though)
<Groogy> and in a generic way so the compiler solves the linkage for me
<Groogy> i.e idea is "the game logic shouldn't understand what serialization is", because that's a different subsystem
<Papierkorb> The logic class should have no serialization at all, it's logic code, not data code
<Papierkorb> That's where I make the split, so I don't see much of an issue
<Groogy> I agree, but as far as I understand, that would put the serialization logic in the class that owns the data we want to serialize?
<Papierkorb> It's OOP. You ask that object to give you a different representation of it. And as long the split is done correctly, there's not much real code in it, so if it even needs special logic for de/serialization, it's not much. Serializer(T) for that sounds like a mess in no time
<Papierkorb> If you don't want to modify Object (Which I can understand), put it into a Base class of all your data classes (if you have that), or use a Module and include that. That way, you can easily modify the logic if needed.
<Groogy> yeah I'll go with that if this thread I am running with shows to not pay off
<crystal-gh> [crystal] mverzilli closed pull request #4692: kernel: Refactor after_fork_child_callbacks (master...refactor-kernel-after-fork-callbacks)
<hightower2> Am I seeing it right that there is no way to retrieve #step, once a #step(N) is defined? E.g. if I have v= (1..10).step(3), there does not appear to be a way to detect in 'v' that step is 3
<oprypin> probably
sz0 has joined #crystal-lang
<travis-ci> crystal-lang/crystal#d803e78 (master - kernel: Refactor after_fork_child_callbacks): The build passed.
<travis-ci> crystal-lang/crystal#d803e78 (master - kernel: Refactor after_fork_child_callbacks): The build passed.
<travis-ci> crystal-lang/crystal#d803e78 (master - kernel: Refactor after_fork_child_callbacks): The build passed.
<crystal-gh> [crystal] mverzilli pushed 1 new commit to master:
<crystal-gh> crystal/master b3c8f87 TSUYUSATO Kitsune: Fix a typo of the context name of parsing asm options
<FromGitter> <bew> By defining a setter with multiple arguments, I can call it with: `Mod.coords = *{1, 2, 3, 4}` but it crashes on `Mod.coords = **{x: 1, y: 2, width: 3, height: 4}` too bad :/ it would be so cool to have/read setters like this WDYT?
<oprypin> bew, this is not a good idea at all.
<FromGitter> <bew> why not?
<Papierkorb> bew, 1) crashes the compiler? Please file an issue about it! 2) Please no, that's hard to use, and hard to read
<oprypin> bew, please use `set_coords`.
<FromGitter> <bew> no the compiler doesn't crash, just `unexpected token **`
<oprypin> any hacks you've been able to do to make the compiler accept multiple arguments for a method ending with `=` are just hacks
<Papierkorb> bew, if a property consists of multiple data values, then you were probably looking to create a struct or class to hold these values
<FromGitter> <bew> yeah I know, was trying to see if I could get ride of that and still have a minimal code without `set_*` or `get_*` stuff
<Papierkorb> why would you get rid of that?
<oprypin> your code is literally longer than if you had `set_*`
<Papierkorb> A `Geometry` (or whatever name) struct sounds perfectly reasonable
<oprypin> just dont call it `AABB`
<FromGitter> <bew> oprypin true, but I wanted to not use `set_*`, to keep the code crystal-ish (in a certain way)
<FromGitter> <bew> `Geometry` is a good name, thx :)
<oprypin> you cannot call something crystal-ish if to do it you need to trick the compiler.
<FromGitter> <bew> ahah, by crystal-ish I mean without using `get_` or `set_` terminology, and directly use `Mod.value` & `Mod.value =`
hightower2 has quit [Read error: Connection reset by peer]
<oprypin> i get the concept
<crystal-gh> [crystal] RX14 opened pull request #4696: improved error message in raise_not_initialized_in_all_initialize (master...feature/better_not_initialized_message)
<FromGitter> <bew> Using geometry is quite long, but it'll do: `builder.coords = 20, 20, 300, 150`
<Papierkorb> Doesn't XCB even call it Geometry too?
<FromGitter> <bew> no, its plain x, y, width, height
<oprypin> `set_coords` still seems best to me in this context
<FromGitter> <bew> I'll put the 2 I think ^^
<travis-ci> crystal-lang/crystal#b3c8f87 (master - Fix a typo of the context name of parsing asm options): The build passed.
<FromGitter> <bew> this way `coords=` uses `set_coords`... problem solved x)
<travis-ci> crystal-lang/crystal#b3c8f87 (master - Fix a typo of the context name of parsing asm options): The build passed.
hightower2 has joined #crystal-lang
<hightower2> If I define def compare( a : Type1, b : Type2), and the comparison is such that compare(a,b)==compare(b,a), is there a way to make this be handled by the shown compare() function without overloading it with types (Type2, Type1)? And if not, am I better off basically just copying the code, or calling compare(b,a) from it?
<FromGitter> <bew> Is there a way to do something like this? (iterate from a macro on a lib-struct fields)
<Papierkorb> hightower2: def'ine your compare methods, and as last method, define a compare method taking a, b (without a type there), and have that one call `compare(b, a)`. This alone can lead to infinite recursion though.
<hightower2> haha, cool idea
<oprypin> 2017-07-06.log:[18:40:41] <oprypin> then `private def compare(a, b); compare(b, a)` .. maybe?
<FromGitter> <bew> this should be possible as lib-structs cannot be re-opened to add more fields
<Papierkorb> bew, iirc, those fields are exposed as instance_variables
<oprypin> yeah but they're not, lol
<FromGitter> <bew> unfortunately is `[]`
<oprypin> still not worth doing it at all
<oprypin> and that extern struct was a feature added to shut me up xD
<oprypin> i've said previously that i think `lib` block should not exist
<FromGitter> <bew> why not? its handly to namespace a lib, and allow custom behavior of some syntax for lib declaration
<FromGitter> <bew> how would you do the difference between a fun inside a lib-block (as a declaration) and outside a lib-block (as a definition) ?
<oprypin> bew, I don't understand. there's no such thing as `fun` outside a lib-block currently
<FromGitter> <bew>
<FromGitter> <bew> it's a function without mangling and clear types
<oprypin> oh.
<oprypin> well the syntax is not such a big deal
<oprypin> `lib` can even stay, but the only thing it would do is make this distinction between declaration and definition, otherwise a normal namespace
<oprypin> my problem with this is you need to duplicate structs everywhere
<FromGitter> <bew> well, as lib-struct cannot be re-open'ed, my macro for should work, and the duplication would almost not exists
<oprypin> sure, except whenever you deal with a lib-struct, you run into all kinds of limitations
<oprypin> like this one - macro methods just werent implemented for them
<FromGitter> <bew> hmmm don't know what to do now that I know all of this...
<oprypin> bew, the easy way out is just forget about iterating on lib struct fields. can still do a macro but make a list to iterate over manually
<FromGitter> <bew> good idea for now, thanks!
<oprypin> or, if during development you notice that you wish to reuse more and more stuff directly from the lib, remember my words, and check where i went nuts with that
<FromGitter> <bew> will do, eventually ;)