jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.18.7 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
rolha has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
blassin has joined #crystal-lang
<blassin> I'm converting an old Crystal 0.10 I think project I had around to the newest version
<blassin> but trying to get this hash to work is killing me
<blassin> the idea is to have a dictionary of info about different opcodes for different versions
<blassin> and so, for version 5 it should contain all info from version 1-4
<blassin> that's the code iterating through the keys
<blassin> the error shown makes me think for some reason the "illegal" NamedTuple is not being specified properly
<asterite> blassin: don't use named tuple for that, use record
<blassin> for the OpcodeInfoEntry?
<blassin> I'll try
tomchapin has quit [Ping timeout: 264 seconds]
<blassin> asterite: updated gist, similar error now with records
<blassin> should I make the OpcountHash container a record too?
<blassin> I've recordified everything
<blassin> the error baffles me:
<blassin> no overload matches 'Hash(Int32, Czm::Opcodes::IllegalOpcodeInfoEntry | Czm::Opcodes::LegalOpcodeInfoEntry).new' with type Hash(Int32, Czm::Opcodes::LegalOpcodeInfoEntry)
<blassin> isn't | used for optional types?
dannluciano has joined #crystal-lang
dannluciano has quit [Ping timeout: 240 seconds]
<blassin> asterite: when you have time, would appreciate a look (made this an issue) https://github.com/crystal-lang/crystal/issues/3064
<blassin> gotta go now, thanks!
blassin has quit [Quit: Page closed]
kulelu88 has quit [Quit: Leaving]
Philpax has quit [Ping timeout: 250 seconds]
dannluciano has joined #crystal-lang
dannluciano has quit [Ping timeout: 240 seconds]
<FromGitter> <kofno> https://carc.in/#/r/151y <-- shouldn't negative counts work, instead of raising an error?
<FromGitter> <kofno> Work-around is to use a range with a -1 end.
<FromGitter> <kofno> But based on the documentation, negative counts should work too
Philpax has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
<FromGitter> <jwoertink> interesting... Anytime I click on those "carc.in" links, they never work. Just tried it in chrome, and looks like it's code!
<FromGitter> <jwoertink> I've always wondered what those were
matp has quit [Remote host closed the connection]
<FromGitter> <kofno> Actually, I may have misread the documentation on the -1 count.
<FromGitter> <kofno> Docs say negative _index_, but don't say anything about how a negative count is handled.
<FromGitter> <kofno> I make that mistake in Ruby too... some_array[1..-1] gets everything after the first element. Of course, I'd like to see a `rest` method for that :)
pawnbox has quit [Ping timeout: 258 seconds]
<adam12> Hmm. Am I crazy to expect this to work? https://carc.in/#/r/1527
<adam12> (select on JSON to pass 2 arguments to my block)
<FromGitter> <jwoertink> I would think that would work. turn the payload in to a hash, then select on the hash passing key and value
<FromGitter> <jwoertink> ah, it doesn't though
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=579ad0dca8a477b5158258e2]
<adam12> Yeah - but looking at JSON::Any, I would assume key/value are passed through. Hmm
Philpax has quit [Ping timeout: 260 seconds]
<adam12> Actually, I think #each works as expected, it's just #select that i'm having issues with.
<adam12> I guess because it's not a proper hash, but still JSON::Any, the select method isn't what I expected.
<FromGitter> <jwoertink> agreed. Maybe a pull request to override it is in order?
<adam12> I think it was done on purpose, imho.
<adam12> I think you need to convert it to a hash to end the possibility of JSON traversal.
<FromGitter> <jwoertink> I guess that would make sense. Be a bit more explicit in what you're trying to do
<adam12> Tho JSON::Any includes Enumerable? so I dunno.
pawnbox has joined #crystal-lang
dannluciano has joined #crystal-lang
dannluciano has quit [Ping timeout: 258 seconds]
matp has joined #crystal-lang
dannluciano has joined #crystal-lang
onethirtyfive has joined #crystal-lang
dannluciano has quit [Ping timeout: 264 seconds]
Philpax has joined #crystal-lang
Philpax has quit [Ping timeout: 260 seconds]
Cidan is now known as zz_Cidan
dannluciano has joined #crystal-lang
matp has quit [Remote host closed the connection]
dannluciano has quit [Ping timeout: 240 seconds]
mark_66 has joined #crystal-lang
rolha has joined #crystal-lang
dannluciano has joined #crystal-lang
dannluciano has quit [Ping timeout: 240 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
willl has quit [Quit: Connection closed for inactivity]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
dannluciano has joined #crystal-lang
dannluciano has quit [Ping timeout: 252 seconds]
A124 has quit [Read error: No route to host]
A124 has joined #crystal-lang
matp has joined #crystal-lang
matp has quit [Remote host closed the connection]
trapped has joined #crystal-lang
matp has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dannluciano has joined #crystal-lang
dannluciano has quit [Ping timeout: 244 seconds]
pawnbox_ has quit [Remote host closed the connection]
steenuil has joined #crystal-lang
dannluciano has joined #crystal-lang
pawnbox has joined #crystal-lang
kostya has joined #crystal-lang
pawnbox has quit [Ping timeout: 258 seconds]
dzv_ has quit [Ping timeout: 240 seconds]
dzv_ has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
Philpax has joined #crystal-lang
dannluciano has quit [Ping timeout: 276 seconds]
pawnbox has joined #crystal-lang
Ven has joined #crystal-lang
<BlaXpirit> so uh are we gonna get a "docrystal" again? cuz it sure seems dead
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RX14> doc.cr would be nice but cr tlds are expensive
<crystal-gh> [crystal] asterite closed pull request #3046: Added support for negating unsigned integers (master...master) https://git.io/vKHb6
<FromGitter> <asterite> It seems that there's no way JSON::Any can be an Enumerable to handle the cases of array and hash, because it yields either one element or two... I think it's better if we made JSON::Any not be an Enumerable to avoid confusion
<crystal-gh> [crystal] asterite pushed 4 new commits to master: https://git.io/vKpAj
<crystal-gh> crystal/master 0c62997 Ary Borenszweig: Compiler: more refactors...
<crystal-gh> crystal/master 11bbf9c Ary Borenszweig: Compiler: renamed `container` to `namespace` in Type
<crystal-gh> crystal/master c657759 Ary Borenszweig: Compiler: removed unused `in_const_block` in codegen
<crystal-gh> [crystal] asterite pushed 2 new commits to master: https://git.io/vKpxR
<crystal-gh> crystal/master 1d2f46b Jacob: IO#encoding fix...
<crystal-gh> crystal/master 7e9bd70 Jacob: IO#encoding specs
<crystal-gh> [crystal] asterite closed pull request #3052: IO#encoding fix (master...patch-1) https://git.io/vK57W
dannluciano has joined #crystal-lang
<travis-ci> crystal-lang/crystal#8a01ad8 (master - Compiler: more refactors, renames and docs): The build was broken. https://travis-ci.org/crystal-lang/crystal/builds/148323761
dannluciano has quit [Ping timeout: 250 seconds]
<travis-ci> crystal-lang/crystal#7e9bd70 (master - IO#encoding specs): The build was broken. https://travis-ci.org/crystal-lang/crystal/builds/148324726
trapped has quit [Read error: Connection reset by peer]
Oliphaunte has joined #crystal-lang
mark_66 has quit [Quit: Leaving.]
<travis-ci> crystal-lang/crystal#7e9bd70 (master - IO#encoding specs): The build was broken. https://travis-ci.org/crystal-lang/crystal/builds/148324726
dannluciano has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vKhJs
<crystal-gh> crystal/master 56f0f0f Ary Borenszweig: ci: install pcre with homebrew
<adam12> Deprecation: The build command was renamed to compile and will be removed in a future version.
<adam12> Deprecation: The compile command was renamed to build and will be removed in a future version.
<adam12> Did we end up settling on one?
<adam12> I'm assuming build, comparing the versions these were output from.
<RX14> adam12, i think we're still using build
<adam12> Thanks :) That makes sense.
<travis-ci> crystal-lang/crystal#56f0f0f (master - ci: install pcre with homebrew): The build has errored. https://travis-ci.org/crystal-lang/crystal/builds/148339122
Philpax has quit [Ping timeout: 252 seconds]
<travis-ci> crystal-lang/crystal#56f0f0f (master - ci: install pcre with homebrew): The build was fixed. https://travis-ci.org/crystal-lang/crystal/builds/148339122
kostya has quit [Quit: Leaving]
willl has joined #crystal-lang
tomchapin has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
zz_Cidan has quit [Ping timeout: 276 seconds]
zz_Cidan has joined #crystal-lang
zz_Cidan is now known as Cidan
Cidan has quit [Changing host]
Cidan has joined #crystal-lang
Oliphaunte has joined #crystal-lang
tomchapin has quit [Quit: Textual IRC Client: www.textualapp.com]
tomchapin has joined #crystal-lang
onethirtyfive has quit [Remote host closed the connection]
tomchapi_ has joined #crystal-lang
tomchapin has quit [Ping timeout: 258 seconds]
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Remote host closed the connection]
<crystal-gh> [crystal] asterite pushed 8 new commits to master: https://git.io/vKhar
<crystal-gh> crystal/master 98bd3b0 Ary Borenszweig: Lexer: fix couldn't lex two consecutive loc pragmas
<crystal-gh> crystal/master 72662fe Ary Borenszweig: Object: use begin/end in getter/property macros that receive a block
<crystal-gh> crystal/master 70ad134 Ary Borenszweig: Compiler: fixed `Call#to_s` sometimes not priting parentheses
<travis-ci> crystal-lang/crystal#e99cee2 (master - Logger: allow passing `nil` for a null logger. Fixes #3065): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/148393608
dannluciano has quit [Ping timeout: 252 seconds]
steenuil has quit [Ping timeout: 264 seconds]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vKhKK
<crystal-gh> crystal/master ea19ae2 Ary Borenszweig: Logger: don't yield to the block on nil logger. Related to #3065
<BlaXpirit> I'm looking for testers (on mac or a 32 bit system) of the new CrSFML
<FromGitter> <sdogruyol> i'm up for OS X
<BlaXpirit> hmm i should've written some instructions, huh
<FromGitter> <sdogruyol> lol
onethirtyfive has joined #crystal-lang
<BlaXpirit> sdogruyol, wrote you a private message
Oliphaunte has quit [Remote host closed the connection]
onethirtyfive has quit [Ping timeout: 240 seconds]
<travis-ci> crystal-lang/crystal#ea19ae2 (master - Logger: don't yield to the block on nil logger. Related to #3065): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/148405465
<FromGitter> <elorest> Do you know if there’s a way to define BigInts without BigInt.new(1). Something equivalent to 123_i64, like 10000_bint
<BlaXpirit> elorest, well, no, they are not tied to the language, just a class
<BlaXpirit> though it's not out of the question that they may be in the future
<FromGitter> <elorest> @blx
<FromGitter> <elorest> @BlaXpirit thanks.
<BlaXpirit> is there any global location to install crystal libraries into?
<RX14> global libraries don't make much sense to me
<BlaXpirit> well crystal doesn't make it easy to use local C libraries
<BlaXpirit> so most of the time you end up with C libraries globally and crystal wrapper locally. easy for them to mismatch. and if it's not a widespread C library, you dont want to have it installed globally
<RX14> what do you mean by mismatch...
<BlaXpirit> wrapper for a new version, actual lib is old
<RX14> well that's just unix
<RX14> nothing much you can do
<BlaXpirit> yes you can do - install packages globally using your package manager
<BlaXpirit> crystal has no such option
<RX14> how does that solve the problem?
<BlaXpirit> package maintainer makes sure the library versions match
<FromGitter> <sdogruyol> i also like to have global install
<RX14> that makes no sense because you depend on the version of the wrapper
<RX14> then you end up with a mess when every system has a different wrapper version
<FromGitter> <sdogruyol> sometimes i wish for statically linked fat binaries
<RX14> and thats worse than the original version because crystal wrappers will change faster than the underlying C libraries
<RX14> dynamic libraries are versioned
<RX14> and you can usually get old versions from your system package manager
<RX14> global crystal libraries don't fix the problem at all
<FromGitter> <Svenskunganka> Hey guys, I'm looking to implement a CSS preprocessor in Crystal to learn the language better. Do you know of any papers or have any pointers on how one would write an efficient parser for such a thing? I've been looking at the YAML implementation in Crystal, but it seems to be using a C implementation so I can't get a lot out of it but there was a bunch of nice things in there.
<RX14> traditional parsers will have a lexer to convert the source code into a stream of tokens
<BlaXpirit> Svenskunganka, check out json maybe, it's great
<RX14> then maybe a recursive descent parser which reads the tokens and constructs a abstract syntax tree
<FromGitter> <sdogruyol> @Svenskunganka there's a Slim like template language written in Crystal which may give you some tips https://github.com/jeromegn/slang
<BlaXpirit> yaml - sure, it's so crazy complex that it's more sensible to use an existing one
<RX14> BlaXpirit, json is on a different level then css preprocessor
<RX14> depends on how complex the input langauge is
<RX14> but you generally want a lexer to convert a string into tokens
<RX14> then construct some datastructures out of the tokens
<RX14> usually an AST for a traditional programming langauge compiler
<RX14> css is a bit simpler
<RX14> again, it depends on the complexity of the input langauge
<RX14> crystal's own compiler has a good example of a lexer
<FromGitter> <Svenskunganka> Oh alright, you guys mentioned some things I'll definitely look up. I know what an AST is but lexer is a bit of a gray area, but thank you guys for the links. I love that there are already so much in the crystal source that I can learn from!
<FromGitter> <Svenskunganka> I'd like it to have support for functions and namespaces, so the Crystal lexer is probably a good resource itself
<RX14> basically what a lexer does is turn `{ foo: "bar"}` into [OBJECT_START, KEYWORD(foo), SEPERATOR, STRING(bar), OBJECT_END]
<FromGitter> <Svenskunganka> Oh, I thought that was an AST?
<RX14> no, an AST is a tree with nested objects
<RX14> this is a simple array of tokens
<FromGitter> <Svenskunganka> OK, thank you for your help!
<RX14> the AST of that would be Object(pairs: [Pair(key: ConstantString(foo), value: ConstantString(bar))])
<RX14> well
<RX14> an AST
<RX14> you can represent it any way you like really
tomchapi_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Oliphaunte has joined #crystal-lang
<FromGitter> <Svenskunganka> Alright looking at the Slang source I see some pointers of what you mean
<FromGitter> <Svenskunganka> This is going to be great! :D
tomchapin has joined #crystal-lang
dannluciano has joined #crystal-lang
dannluciano has quit [Ping timeout: 276 seconds]
<crystal-gh> [crystal] asterite pushed 3 new commits to master: https://git.io/vKh5x
<crystal-gh> crystal/master 6967838 Ary Borenszweig: Compiler: try to invoke `finalize` in `new` if a type responds to it. Fixes #3060
<crystal-gh> crystal/master c2ba050 Ary Borenszweig: Fixed #3045: error when redining fun with different signautre
<crystal-gh> crystal/master a2ff203 Ary Borenszweig: Compiler: no need to store "new expansions" in Program
pawnbox has quit [Remote host closed the connection]
<travis-ci> crystal-lang/crystal#a2ff203 (master - Compiler: no need to store "new expansions" in Program): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/148428799
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 244 seconds]
tomchapin has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
matp has quit [Remote host closed the connection]
<crystal-gh> [crystal] asterite pushed 4 new commits to master: https://git.io/vKjfj
<crystal-gh> crystal/master 917ba96 Ary Borenszweig: Macros: use MemoryIO for building, because of {{debug()}}
<crystal-gh> crystal/master 7afbc2f Ary Borenszweig: Compiler: surround `{{yield}}` with begin/end
<crystal-gh> crystal/master 93edf52 Ary Borenszweig: Revert "Object: use begin/end in getter/property macros that receive a block"...
dannluciano has joined #crystal-lang
rolha has quit [Read error: Connection reset by peer]
rolha has joined #crystal-lang
pawnbox has joined #crystal-lang
dannluciano has quit [Ping timeout: 244 seconds]
pawnbox has quit [Ping timeout: 250 seconds]
<travis-ci> crystal-lang/crystal#c1fe6da (master - Formatter: correctly indent unions after newline): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/148450173
pawnbox has joined #crystal-lang
rolha has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Oliphaunte has quit [Remote host closed the connection]
pawnbox has quit [Ping timeout: 276 seconds]
kfpratt has joined #crystal-lang
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 276 seconds]