RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.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
_whitelogger has joined #crystal-lang
DmitryBochkarev has joined #crystal-lang
DmitryBochkarev has quit [Ping timeout: 268 seconds]
Kixune has joined #crystal-lang
Kixune has quit [Client Quit]
return0e has quit [Read error: Connection reset by peer]
return0e_ has joined #crystal-lang
DmitryBochkarev has joined #crystal-lang
_whitelogger has joined #crystal-lang
tdc has joined #crystal-lang
ashirase has quit [Ping timeout: 246 seconds]
ashirase has joined #crystal-lang
<wuehlmaus> is ``a = gets.to_s.to_i; a*a'' the most elegant way to deal with input numbers because of String?
<FromGitter> <bew> you have to handle the case when there's no input (would be nil), either by raising or printing an error or give a default..
<FromGitter> <bew> Relying on Nil#to_s to give a "" is a bad way to handle it imo
<wuehlmaus> yes, makes sense
<FromGitter> <silmanduin66> Hi, i have a web messages app. How can i prevent the client to fake the message timestamp ? My first idea was to check on the crystal side if the timestamp was within a rang of maybe 10s old and reject if not. Is this a good solution ? how do people usually do that ?
<FromGitter> <Prutheus> on my macbook, i get the error when runninjg crystal `library not found for -lssl (this usually means you need to install the development package for libssl)`
<FromGitter> <Prutheus> how to resolve that?
<FromGitter> <anicholson> πŸ‘‹ I'm playing with the C bindings. I have a function that expects a `char**` as a parameter. I know from C experience that that's akin to an array of strings, but I also know I can't just pass that across the boundary. How can I get from `["word1", "word2"] : Array(String)` to something that's `Pointer(Pointer(UInt8))`?
<FromGitter> <anicholson> found an answer on Usenet: https://groups.google.com/d/msg/crystal-lang/zTMrN5t8XP8/QgsDot8yDQAJ
<FromGitter> <Prutheus> someone an answer for me?
<FromGitter> <Prutheus> > on my macbook, i get the error when runninjg crystal `library not found for -lssl (this usually means you need to install the development package for libssl)`
<FromGitter> <Blacksmoke16> :shrug: prob are missing that lib or its location isnt in path?
<FromGitter> <asterite> maybe the new design of stackoverflow will bring more attention to it and help respond to some unanswered questions: https://stackoverflow.com/questions/55432019/how-can-webpack-be-replaced-by-something-else-in-an-amber-framework-application
<FromGitter> <anicholson> @Prutheus some questions: ⏎ ⏎ 1) how did you install Crystal? ⏎ 2) what version of OSX are you running? [https://gitter.im/crystal-lang/crystal?at=5ca2030e1f6e900d5ebd7d1c]
<FromGitter> <Prutheus> i am using homebrew and it worked before, just now not
<FromGitter> <anicholson> then what may have happened is your version of `libssl` got upgraded since you installed Crystal last.
<FromGitter> <Prutheus> it could be
<FromGitter> <anicholson> if that's the case, uninstalling re-installing Crystal will probably work
<FromGitter> <anicholson> as it will pick up the new libssl version while it's building
<FromGitter> <Prutheus> no not working
<FromGitter> <anicholson> have you done an OSX upgrade recently?
<FromGitter> <Prutheus> yes
<FromGitter> <anicholson> @Prutheus ^ yep, try that
<FromGitter> <Prutheus> worked
<FromGitter> <Prutheus> thanks
tdc has quit [Quit: Leaving]
lucasb has joined #crystal-lang
<FromGitter> <r00ster91> is there any reason to not make the most classes in JSON (https://crystal-lang.org/api/0.27.2/JSON.html) structs?
DmitryBochkarev has quit [Ping timeout: 268 seconds]
<z64> @r00ster91 you mean like PullParser?
<FromGitter> <r00ster91> yes, for example
<z64> `Char::Reader` is a similar stateful, IO-like class. if `JSON::PullParser` were pass by copy instead, then things like converters would be impossible because the parsers state would not be updated from the original context (inside `new(parser)`)
<z64> essentially this would happen
<FromGitter> <r00ster91> oh, then perhaps just Token, Parser and Lexer
<z64> that likely is also unsafe because they wrap an IO. if copies of these objects consumed the IO, it would cause other instances to be corrupted / unexpected behavior
<z64> as far as Token goes, i don't think it really matters. IIRC one instance of a token is created and the memory is reused
<FromGitter> <r00ster91> ah ok. Then I will delete the branch, thanks
<FromGitter> <j8r> We can parse without having Token
<FromGitter> <j8r> Builder can be a struct
<FromGitter> <j8r> PullParser must be a class because the object state is passed to methods as an argument
DmitryBochkarev has joined #crystal-lang
<FromGitter> <j8r> Lexer can be a struct too
<FromGitter> <j8r> I've still the plan to refactor JSON thanks to the work done on CON
<FromGitter> <j8r> Lexer is used internally by PullParser, so the risk of IO copy conflicts is low
<jokke> CON?
<FromGitter> <j8r> you're jreinert?
<jokke> yeah
<jokke> y?
<jokke> j8
<jokke> @j8r
<FromGitter> <j8r> so you're a stargazzer my friend https://github.com/j8r/con/stargazers
DmitryBochkarev has quit [Ping timeout: 268 seconds]
DmitryBochkarev has joined #crystal-lang
<FromGitter> <vladfaust> Do we have embedded ruby shard? Like lua.cr
<FromGitter> <vladfaust> Didn't find anything on crystalshards
<FromGitter> <r00ster91> I think it would be possible to write C bindings to Ruby's C API: https://silverhammermba.github.io/emberb/c/
<FromGitter> <r00ster91> similar to how lua.cr accesses liblua
<FromGitter> <vladfaust> Nice, thanks
Yxhuvud has joined #crystal-lang
DmitryBochkarev has quit [Ping timeout: 245 seconds]
<FromGitter> <Blacksmoke16> https://github.com/Blacksmoke16/CrSerializer/issues/8 if anyone has thoughts
lucasb has quit [Quit: Connection closed for inactivity]
DTZUZO has quit [Ping timeout: 268 seconds]
<FromGitter> <Maroo-b> Hey, ⏎ can someone please point me where I should look to learn about autocasting in Crystal, I'm interested currently in casting Enum to Symbol. ⏎ I understand that this feature is not documented as discussed in this issue: https://github.com/crystal-lang/crystal/issues/6736 but any explanation of help is appreciated. ⏎ Thanks. [https://gitter.im/crystal-lang/crystal?at=5ca2868e3ebbdc55b346144b]
<FromGitter> <parruda> Hey guys, is anybody here in SF?
return0e_ has quit []
<FromGitter> <aemadrid> anybody using any other testing framework/shard other than the sodlib spec?
<FromGitter> <aemadrid> I’m kinda missing the full RSpec with `let`/hooks/etc
<FromGitter> <aemadrid> `minitest.cr` looks promising, anybody using it?
<FromGitter> <Blacksmoke16> a few people, im not a fan imo
<FromGitter> <aemadrid> so you prefer stdlib spec then?
<FromGitter> <Blacksmoke16> i do. mostly since im not familiar with RSpec and all that stuff, so its harder to work on when its using a, pretty much totally different setup than a lot of other projects
<FromGitter> <aemadrid> ok
<FromGitter> <Blacksmoke16> plus its not fun to have your specs be dependent on a third party shard, if something breaks are out of luck till it gets fixed
<FromGitter> <Blacksmoke16> but its maintained by a core dev so isnt that big of an issue
<FromGitter> <aemadrid> I can see that. I liked spec2 but it doesn’t look like it will get updates anytime soon
<FromGitter> <Blacksmoke16> KISS
<FromGitter> <Blacksmoke16> just a lot of sugar :P
<FromGitter> <Blacksmoke16> always can make a PR to the stdlib implementation ;)
<FromGitter> <aemadrid> one problem I have with spec is that you end up having free standing vars or you repeat a lot of code
<FromGitter> <aemadrid> feels weird/dirty
<FromGitter> <Blacksmoke16> each spec assertion, imo, should be independent, so its not that bad if you think about it. plus could create helper methods in your spec_helper.cr file that could abstract some boilerplate, also got macros
<FromGitter> <aemadrid> to sharing params for example makes it easier to see that you are testing differents scenarios or parts
<FromGitter> <aemadrid> instead of having one single scenario testing multiple things
<FromGitter> <Blacksmoke16> all depends on what you're used to i guess
<FromGitter> <aemadrid> yup
beepdog has quit [Ping timeout: 240 seconds]
beepdog has joined #crystal-lang