RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.20.4 | Fund Crystal's 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
Ven has joined #crystal-lang
Raimondi has quit [Remote host closed the connection]
Raimondi has joined #crystal-lang
Ven has quit [Ping timeout: 240 seconds]
Ven has joined #crystal-lang
jhass has quit [Ping timeout: 245 seconds]
Ven has quit [Read error: Connection reset by peer]
asterite has quit [Ping timeout: 256 seconds]
Ven has joined #crystal-lang
asterite has joined #crystal-lang
Ven has quit [Ping timeout: 258 seconds]
jhass has joined #crystal-lang
Ven has joined #crystal-lang
onvsop has joined #crystal-lang
Ven has quit [Ping timeout: 252 seconds]
Ven has joined #crystal-lang
pawnbox_ has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Ven has quit [Ping timeout: 260 seconds]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 260 seconds]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 245 seconds]
Raimondi has quit [Ping timeout: 252 seconds]
Raimondii has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Read error: Connection reset by peer]
Raimondii is now known as Raimondi
triangles has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 258 seconds]
_whitelogger has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 260 seconds]
Ven has joined #crystal-lang
Ven has quit [Read error: Connection reset by peer]
Ven has joined #crystal-lang
Raimondi has quit [Ping timeout: 252 seconds]
Ven has quit [Ping timeout: 255 seconds]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 255 seconds]
snsei has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 245 seconds]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 248 seconds]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 248 seconds]
<FromGitter> <samueleaton> with crystal-db (pg) I can open and close connections as I please, and the connections go back into a pool of connections, right? It wouldn't be bad practice to "open" a connection in each of my app's routes because it is actually just using an existing connection from a pool?
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 255 seconds]
onvsop has quit [Read error: Connection reset by peer]
<FromGitter> <sdogruyol> Yup
Ven has joined #crystal-lang
Ven has quit [Client Quit]
bjz has joined #crystal-lang
<FromGitter> <samueleaton> I'm confused...They why do we pass pool options (via query params) with each connection string? ⏎ It looks like here its creating a whole new pool with each new database connection: https://github.com/crystal-lang/crystal-db/blob/4e238f655f1f32a1298c79a46cb16a7cdf18699a/src/db/database.cr#L49
<FromGitter> <sdogruyol> Are you sure
<FromGitter> <samueleaton> It has the pool options in this sample: https://crystal-lang.org/docs/database/connection_pool.html#sample ⏎ Its seems a little weird that you can pass in the pool options with each connection.
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
bjz has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <sdogruyol> @samueleaton you mean using DB.open every time?
kellabyte has quit [Ping timeout: 255 seconds]
bjmllr has quit [Ping timeout: 255 seconds]
aemadrid has quit [Ping timeout: 255 seconds]
hmans has quit [Ping timeout: 255 seconds]
aemadrid has joined #crystal-lang
kellabyte has joined #crystal-lang
bjmllr has joined #crystal-lang
hmans has joined #crystal-lang
triangles2 has joined #crystal-lang
triangles has quit [Ping timeout: 255 seconds]
mark_66 has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 240 seconds]
Kug3lis has joined #crystal-lang
bjz has joined #crystal-lang
bjz_ has quit [Ping timeout: 260 seconds]
Yxhuvud has quit [Read error: Connection reset by peer]
Yxhuvud has joined #crystal-lang
<crystal-gh> [crystal] firejox opened pull request #3882: disallow other type inherit from String (master...forbid-string-inherited) https://git.io/vM2lj
<DeBot> https://github.com/crystal-lang/crystal/pull/3882 (disallow other type inherit from String)
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
bjz has quit [Read error: Connection reset by peer]
bjz_ has joined #crystal-lang
pawnbox_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
<crystal-gh> [crystal] MakeNowJust opened pull request #3883: Add JSON::Any#to_a and JSON::Any#to_h (master...feature/json-any/to-h-to-a) https://git.io/vM20f
<DeBot> https://github.com/crystal-lang/crystal/pull/3883 (Add JSON::Any#to_a and JSON::Any#to_h)
Yxhuvud has quit [Ping timeout: 240 seconds]
bjz has joined #crystal-lang
bjz_ has quit [Ping timeout: 245 seconds]
Yxhuvud has joined #crystal-lang
gewo has quit [Quit: WeeChat 1.0.1]
pawnbox_ has quit [Ping timeout: 252 seconds]
pawnbox has joined #crystal-lang
Raimondi has joined #crystal-lang
pawnbox has quit [Ping timeout: 256 seconds]
pawnbox has joined #crystal-lang
Raimondi has quit [Ping timeout: 258 seconds]
pawnbox has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
triangles2 has quit [Ping timeout: 240 seconds]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 240 seconds]
Ven has joined #crystal-lang
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<crystal-gh> [crystal] asterite closed pull request #3883: Add JSON::Any#to_a and JSON::Any#to_h (master...feature/json-any/to-h-to-a) https://git.io/vM20f
<DeBot> https://github.com/crystal-lang/crystal/pull/3883 (Add JSON::Any#to_a and JSON::Any#to_h)
Ven has quit [Ping timeout: 240 seconds]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 245 seconds]
Ven has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
Raimondi has joined #crystal-lang
pawnbox has joined #crystal-lang
literal has quit [Quit: Lost terminal]
literal has joined #crystal-lang
mark_661 has joined #crystal-lang
mark_66 has quit [Ping timeout: 240 seconds]
<FromGitter> <bcardiff> @samueleaton DB.open creates a connection pool. That's right. You can open one pool for the whole process and per route handler request a connection or even use the Database object directly if you don't need to use *exactly* the same connection per command.
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Kug3lis has joined #crystal-lang
Kug3lis has quit [Client Quit]
Kug3lis has joined #crystal-lang
<FromGitter> <exts> How come line 6 errors out? https://gist.github.com/exts/96858422e1f83cca6aa7a4e157a07f29
<FromGitter> <david50407> Compiler think that you are giving a block
<crystal-gh> [crystal] bcardiff pushed 1 new commit to master: https://git.io/vM2Q2
<crystal-gh> crystal/master 82671f5 Brian J. Cardiff: fix #3884. restore json serialization of Crystal::Exception
<DeBot> https://github.com/crystal-lang/crystal/issues/3884 (Regression Playground does not report compilation errors)
<FromGitter> <samueleaton> @bcardiff ideally I'd want one pool for the whole app but I don't see a clear way to checkout/checkin connections to and from the pool. I was originally thinking DB.open would just checkout a connection from a pool but you confirmed that its creating a new pool.
<FromGitter> <bcardiff> @samueleaton #using_connection is probably what you want or #transaction http://crystal-lang.github.io/crystal-db/api/0.3.3/DB/Database.html#transaction%28%26block%29-instance-method to be run in each route, again *if you want to checkout explicit a connection*. The only scenario I could think of is a transaction.
<FromGitter> <fridgerator> ```db = DB.open "db_url" ⏎ *do things here* ⏎ db.close``` [https://gitter.im/crystal-lang/crystal?at=5878e1da873d96e16d634575]
<FromGitter> <bcardiff> @samueleaton why you want to checkout out connections explicitly?
<FromGitter> <samueleaton> I just wanted to be able to do something as simple as DB.open for each route and know that it was pooling all of my connections. So if I were to do DB.open once in my app and then every time I do db.query it will automatically checkout/in connections?
<FromGitter> <samueleaton> @bcardiff I guess what might be confusing me is why DB.open takes a block that opens and closes a pool. Wouldn't opening and closing pools be expensive?
snsei has joined #crystal-lang
<FromGitter> <bcardiff> DB.open has a yielding and non yielding version. It could be time consuming if the initial pool size is more than one.
<FromGitter> <bcardiff> having a pool with connections ready is better for attending request actually.
<crystal-gh> [crystal] asterite closed pull request #3882: disallow other type inherit from String (master...forbid-string-inherited) https://git.io/vM2lj
<DeBot> https://github.com/crystal-lang/crystal/pull/3882 (disallow other type inherit from String)
<FromGitter> <bcardiff> and yes, when you db.exec / query a connection from the pool is checked out. if non is available a new will be built, unless the max is reached. in that case you will be delayed for a bit. if none come available an exception will raise.
<FromGitter> <samueleaton> Ok, thanks @bcardiff !!!
<FromGitter> <bcardiff> welcome :-). you might come accross https://github.com/crystal-lang/crystal-db/issues/35 which already has a PR on it's way.
<crystal-gh> [crystal] bcardiff closed pull request #3876: Implement Rabin-Karp algorithm for String#rindex (master...feature/string/rindex-rabin-karp) https://git.io/vMznf
<DeBot> https://github.com/crystal-lang/crystal/pull/3876 (Implement Rabin-Karp algorithm for String#rindex)
<travis-ci> crystal-lang/crystal#82671f5 (master - fix #3884. restore json serialization of Crystal::Exception): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/191640701
<DeBot> https://github.com/crystal-lang/crystal/issues/3884 (Regression Playground does not report compilation errors)
<FromGitter> <samueleaton> @bcardiff now that I have your ear... I was having a problem last night where my specs would just stop at a rs.read(String) for minutes without ever continuing. No errors or anything. I put a "puts" statement before and after it to verify that it would just halt (it never runs the second puts). I'll look more into it today and try to find a simple way to reproduce my problem.
<FromGitter> <samueleaton> Any preliminary advice on how to debug?
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<crystal-gh> [crystal] bcardiff closed pull request #3732: Add "expand" command to Crystal tools (master...feature/crystal-tool/expand) https://git.io/v1dpm
<DeBot> https://github.com/crystal-lang/crystal/pull/3732 (Add "expand" command to Crystal tools)
<crystal-gh> [crystal] asterite pushed 2 new commits to master: https://git.io/vM2jm
<crystal-gh> crystal/master bea18ec Ary Borenszweig: Fixed `Reference#dup` not working with private classes. Fixes #3858 . Fixes #3878
<crystal-gh> crystal/master 19fd176 Ary Borenszweig: Let sizeof and instance_sizeof work with virtual types
<DeBot> https://github.com/crystal-lang/crystal/pull/3858 (Fix Reference#dup of file private class) | https://github.com/crystal-lang/crystal/issues/3878 (Unable to invoke macros on file private classes)
<FromGitter> <bcardiff> for pg / mysql the read will consume the socket. Maybe you are calling read more times that the amount of columns ... but I would expect some protocol exception to raise in that case.
<FromGitter> <bcardiff> since the socket could be open and on hold for receiving more data you could be experiencing that freeze ...
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
<travis-ci> crystal-lang/crystal#cb75a9a (master - forbid other type inherit from String): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/191648752
Kug3lis has joined #crystal-lang
gloscombe has joined #crystal-lang
Philpax has quit [Ping timeout: 256 seconds]
mark_661 has quit [Remote host closed the connection]
<travis-ci> crystal-lang/crystal#88e5cf2 (master - Implement Rabin-Karp algorithm for String#rindex): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/191652064
<FromGitter> <samueleaton> @bcardiff Its the first read() of the block. And before that rs.read I am able to do rs.column_name(0) so I know there is data. Also if I inspect the rs It is *HUGE*. Its caching all of my "delete from" queries that I run in `before_each` for all of my specs.
<FromGitter> <spalladino> @samueleaton could you share some of your code, if it's public? How are you invoking the `delete`s, by the way?
<FromGitter> <bcardiff> result_set -> connection -> cache of prepared statements. yes it is huge.
<FromGitter> <bcardiff> I was going to ask for the same. show me code :-)
<FromGitter> <samueleaton> its not public but I'll throw something together sometime this morning. Should I take this into a PM or open an issue for us to continue the discussion?
<RX14> github down for anyone else?
<FromGitter> <samueleaton> yes. unicorn
<RX14> same
<FromGitter> <Sija> @RX14 yep, same here
<FromGitter> <bcardiff> Ok (╯°□°)╯︵ ┻━┻ lunch time
<FromGitter> <paulcsmith> I'm getting a strange error when trying to create an HTTP::Handler. Any idea why it says this? https://play.crystal-lang.org/#/r/1k95
<RX14> at least I opened all my GH notification tabs at the same time
<RX14> so I have a few remaining github tabs
<FromGitter> <paulcsmith> `Error in line 3: HTTP::Handler is not a class, it's a module` But in the docs and the crystal source, it is an abstract class
<RX14> @paulcsmith where does it say that in the docs?
<RX14> and if the sources say that, you're not looking at the latest release
<FromGitter> <Sija> @paulcsmith see https://crystal-lang.org/api/0.20.4/HTTP/Handler.html
<FromGitter> <paulcsmith> Oh that must have changed recently
<FromGitter> <paulcsmith> Sorry about that. Maybe the docs I was looking at were old
<FromGitter> <samueleaton> @bcardiff @spalladino I'll just open an issue later with some code. Thanks guys!
<FromGitter> <paulcsmith> Yep, I was looking at 0.20.1. That was what was in my browser autocomplete. My bad. Thanks!
<RX14> add a shortcut to go to just crystal-lang.org/api
<RX14> it'll redirect you to latets
<travis-ci> crystal-lang/crystal#6bd4bed (master - Implement "crystal tool expand" command (#3732)): The build has errored. https://travis-ci.org/crystal-lang/crystal/builds/191663481
<FromGitter> <samueleaton> I like to change the `0.20.4`, `0.20.1`, etc in the path of the api to just be master all the time so I always see the latest docs. e.g. `/api/master`
hako_ has joined #crystal-lang
hako has quit [Read error: Connection reset by peer]
Kug3lis_ has joined #crystal-lang
Kug3lis has quit [Ping timeout: 258 seconds]
Kug3lis_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Kug3lis has joined #crystal-lang
nomethoderror has joined #crystal-lang
nomethoderror has quit [Client Quit]
mhib has joined #crystal-lang
DeBot has quit [Remote host closed the connection]
mhib has quit [Client Quit]
DeBot has joined #crystal-lang
<FromGitter> <bcardiff> @samueleaton /api/latest/** is rewriten with the lastest tag :-)
Cyrus has quit [Quit: Leaving]
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Kug3lis has joined #crystal-lang
Kug3lis has quit [Ping timeout: 240 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
Cyrus has joined #crystal-lang
<FromGitter> <Sija> @bcardiff IIRC there’s no published docs for `master` branch?
<FromGitter> <bcardiff> yes there is https://crystal-lang.org/api/master/
<FromGitter> <Sija> oh nice! thanks for a tip :)
gloscombe has quit [Quit: Lost terminal]
pawnbox has joined #crystal-lang
<travis-ci> crystal-lang/crystal#bea18ec (master - Fixed `Reference#dup` not working with private classes. Fixes #3858 . Fixes #3878): The build was broken. https://travis-ci.org/crystal-lang/crystal/builds/191665358
<DeBot> https://github.com/crystal-lang/crystal/pull/3858 (Fix Reference#dup of file private class) | https://github.com/crystal-lang/crystal/issues/3878 (Unable to invoke macros on file private classes)
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vMaC5
<crystal-gh> crystal/master d27c801 Ary Borenszweig: Fixed sizeof spec for 32 bits
<crystal-gh> [crystal] david50407 opened pull request #3887: Remove default new for modules (master...no_default_new_in_module) https://git.io/vMa8y
<DeBot> https://github.com/crystal-lang/crystal/pull/3887 (Remove default new for modules)
nomethoderror has joined #crystal-lang
nomethoderror has quit [Client Quit]
A124 has quit [Quit: '']
A124 has joined #crystal-lang
<travis-ci> crystal-lang/crystal#d27c801 (master - Fixed sizeof spec for 32 bits): The build was fixed. https://travis-ci.org/crystal-lang/crystal/builds/191712618
nomethoderror has joined #crystal-lang
nomethoderror has quit [Client Quit]
emancu has joined #crystal-lang
bjz has joined #crystal-lang
<FromGitter> <paulcsmith> I'm having trouble with this overload: https://gist.github.com/paulcsmith/ef45dc689f44881ca0b7eeeb555edef4 I'm not sure why it's trying the method that doesn't seem to match :S
DeBot has quit [Remote host closed the connection]
DeBot has joined #crystal-lang
<crystal-gh> [crystal] david50407 closed pull request #3887: Remove default new for modules (master...no_default_new_in_module) https://git.io/vMa8y
<DeBot> https://github.com/crystal-lang/crystal/pull/3887 (Remove default new for modules)
emancu has quit []
<FromGitter> <paulcsmith> The arity doesn't even match so I'm not sure what's up
<FromGitter> <spalladino> Could you share the definitions of `LuckyWeb::HTMLView#h6` as well?
pawnbox has quit [Remote host closed the connection]
<FromGitter> <paulcsmith> These are generated with a macro, but here is the generated code for #h6 https://gist.github.com/paulcsmith/5392b466ba88ede134175097d8f74812
<FromGitter> <paulcsmith> Oh let me paste in the `build_tag_attrs` as well in case that's important
pawnbox has joined #crystal-lang
<FromGitter> <paulcsmith> Also this is public at https://github.com/luckyframework/web/blob/ps-init/spec/lucky_web/html_view_spec.cr and the corresponding view code at https://github.com/luckyframework/web/blob/ps-init/src/lucky_web/html_view.cr. That might be easier than gists
DeBot has quit [Remote host closed the connection]
DeBot has joined #crystal-lang
<FromGitter> <david50407> cause you don't have `(**options, &block)` overload
<FromGitter> <paulcsmith> Thank you sir :)
<FromGitter> <spalladino> By the way, the `no argument named class` refers to named arguments. See https://crystal-lang.org/docs/syntax_and_semantics/default_values_named_arguments_splats_tuples_and_overloading.html
<FromGitter> <paulcsmith> @spalladino Thanks Santiago. I really appreciate the help
<FromGitter> <spalladino> Anytime!
<FromGitter> <paulcsmith> Loving the language so far. Started writing a small web framework with a buddy at work today and it's been quite fun :D
<FromGitter> <spalladino> Love to hear that! Make sure to add it to https://github.com/veelenga/awesome-crystal if you want to share it with the community
<FromGitter> <paulcsmith> Will do :D Not quite ready yet, but hopefully in a few weeks!
<crystal-gh> [crystal] david50407 opened pull request #3889: Not to expend default new for non-class (master...no_default_new_in_module) https://git.io/vMaDo
<DeBot> https://github.com/crystal-lang/crystal/pull/3889 (Not to expend default new for non-class)
<literal> so, I can't use abstract class names in type definitions?
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<RX14> literal, can you show me the bug?
<RX14> well, code
<literal> instance variable '@foo' of Bar must be Baz, not Baz::Quux <-- when assigning an instance of Baz::Quux to @foo
<RX14> can I have the code you're suing too please
<literal> one moment
<literal> uh, yeah, misspelled a class name, sorry about that :)
<FromGitter> <samueleaton> @bcardiff @spalladino About my problem was earlier. I was doing something like: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I am still confused why it just hung there though instead of giving me an error. [https://gitter.im/crystal-lang/crystal?at=587941d4cbcb28177067e244]
<FromGitter> <spalladino> Which adapter (mysql, postgres or sqlite)?
<FromGitter> <samueleaton> PG. BTW my query is returning several columns (but a single row). I am simplifying here in my examples.
<FromGitter> <spalladino> Hmm aren't you missing to wrap the `rs.read` in a `rs.each` in order to advance to the first row?
<FromGitter> <samueleaton> Exactly. But i would expect it to complain.
<FromGitter> <spalladino> If you do add it, it works?
<FromGitter> <samueleaton> Let me try it. one sec
<FromGitter> <spalladino> Even if it works, please open an issue in crystal-db explaining the situation; if making that check does not incur in a performance penalty, I'd consider adding it to raise an exception rather than just hanging on the socket
<FromGitter> <samueleaton> yes. That fixes it. Will open an issue.
<FromGitter> <spalladino> Thx!
<FromGitter> <samueleaton> Thanks for the help https://github.com/crystal-lang/crystal-db/issues/37
kotwal has joined #crystal-lang
kotwal has quit [Client Quit]
<FromGitter> <aeosynth> how do i create a json mapping when the source is a hash with unknown keys, but the values have known structure?
<BlaXpirit> aeosynth, maybe don't create a json mapping..?
<FromGitter> <aeosynth> @BlaXpirit sure, but it would be nicer to declare my type in one place, instead of casting everything inline
<BlaXpirit> aeosynth, well you could do this inefficient thing.. define json mappings for your kinds of values, then parse the json, do whatever logic and use `SomeType.from_json(parsed[key].to_json)`
<FromGitter> <spalladino> Maybe something like this? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=587959c36c1635643c272bda]
<FromGitter> <spalladino> That returns `{"key1" => #<Foo:0x10f34fac0 @foo="fooval", @bar="barval">}`
<BlaXpirit> oh it's pretty good assuming all values have the same type, but i did not infer that
<bmcginty_> I'd like to do some work on the xml library, allow setting properties with xmlnodesetprop, etc. any reason this would be a problem?
<FromGitter> <spalladino> That's what I understood at least. @aeosynth could you clarify?
<FromGitter> <aeosynth> that looks promising, i will try it
<BlaXpirit> oh wow, it even works for values of different types! https://carc.in/#/r/1k9j
<FromGitter> <spalladino> It will basically attempt with all types in the union catching all parse exceptions until it finds a match
<FromGitter> <jwoertink> How do you handle a property that can't be nil, but also doesn't have a default value? Is there a way to tell the compiler that I want to throw an error if the property isn't assigned?
<FromGitter> <jwoertink> or is it better to just make the type a union, and catch the error if it's nil?
<FromGitter> <spalladino> @jwoertink are we still talking about json mapping, or you mean in general?
<FromGitter> <jwoertink> in general
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58795f0dcbcb281770688525]
<FromGitter> <spalladino> Yep, in that case, the compiler will complain if it finds a case where x does not get initialized
<FromGitter> <spalladino> Since you have just one constructor and it always sets x, it should be ok
<FromGitter> <spalladino> (by the way, `def initialize(@x); end` is a shorthand, though not exactly the same)
<FromGitter> <jwoertink> In this case, is it better to just make `property x : String | Nil`, then catch for nil?
<BlaXpirit> jwoertink, no, why make a runtime error when you can make a compile time error?
<FromGitter> <spalladino> I'd say no, if `x` should always be set, then leave `x` as String, and the compiler will let you know if you attempt to assign `nil` to it at any point
<FromGitter> <jwoertink> Ah... ok, I see what I'm doing wrong here
<FromGitter> <jwoertink> actually.. maybe not lol
<FromGitter> <jwoertink> I need my example to be a little more detailed
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=58796065300f220a66e59fca]
<FromGitter> <jwoertink> ^ this is complaining about the @x being nilable since it's not initialized
<BlaXpirit> jwoertink, yes, initialization works only if you write @x =
<BlaXpirit> self.x = is roundtripping through a method and doesn't count as initialization
<BlaXpirit> because compiler doesnt want to look through what methods may or may not do, it's inefficient
<FromGitter> <jwoertink> ah! that's what it was
<FromGitter> <jwoertink> that makes sense. Thanks!
<BlaXpirit> additionally, if you're looking to create a constructor based on another constructor, it's usually best to write like this: `def self.new; self.new("A"); end`
<BlaXpirit> because, again, you're going through an `initialize` method and it probably won't work
<FromGitter> <jwoertink> interesting. Ok, I'll try that.
<RX14> I should probably follow up on https://news.ycombinator.com/item?id=13285344 and investigate quasiquoting for crystal macros
<RX14> not quite got a handle on what it is
<RX14> bit it looks interesting at least
elia has joined #crystal-lang