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>
<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?
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)`)
<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
<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