<hightower2>
Ok looks like I'll be calling Time#epoch and Time#nanosecond to get the two values that I need for feeding back into Time.new( seconds:, nanoseconds: )
<hightower2>
And I really wonder what the hell would need to be in compare_versions to recognize that 0.23.1 is actually older than 0.23.0+313
<Papierkorb>
.. lol
<hightower2>
fucking terrible
<hightower2>
(And the mentioned issue of having to manually account for summing two nanosecond values that then overflow into a full second)
hightower2 has left #crystal-lang ["Leaving"]
snsei has joined #crystal-lang
woodruffw has quit [Ping timeout: 268 seconds]
woodruffw has joined #crystal-lang
woodruffw has quit [Changing host]
woodruffw has joined #crystal-lang
astronav_ has joined #crystal-lang
astronavt has quit [Ping timeout: 250 seconds]
astronav_ is now known as astronavt
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 240 seconds]
faustinoaq has quit [Ping timeout: 255 seconds]
faustinoaq has joined #crystal-lang
aroaminggeek has quit [Read error: Connection reset by peer]
aroaming_ has joined #crystal-lang
_whitelogger has joined #crystal-lang
aroaminggeek has joined #crystal-lang
aroaming_ has quit [Ping timeout: 260 seconds]
DTZUZO has quit [Quit: WeeChat 2.0]
DTZUZO has joined #crystal-lang
aroaminggeek is now known as aroaminggeek[awa
aroaminggeek[awa is now known as aroaminggeek
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei_ has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
astronavt has quit [Remote host closed the connection]
aroaminggeek is now known as aroaminggeek[awa
ashirase has quit [Ping timeout: 248 seconds]
aroaminggeek[awa is now known as aroaminggeek
ashirase has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter>
<drosehn> Is there some nice simple-looking example on how to use `Process.run()` the way one would use `IO.popen()` in ruby? What I want to do is execute some command, parse the output of that command, and also know the command-status.
<FromGitter>
<drosehn> I've spent two hours trying to guess my way through it (after looking at various API pages), and I have something which almost works except I don't know when to stop reading from the `IO::FileDescriptor` for the output. And then my program dies with the error `kill: No such process (Errno)`.
<FromGitter>
<drosehn> Also, I'm not doing anything with the error output from the command I'm running, and it seems to me that I should be checking it. I'd think that would be the big advantage of crystal's `Process.run` over ruby's `IO.popen()`, assuming I could figure out how to use it correctly.
alex`` has joined #crystal-lang
snsei_ has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter>
<bew> also looks like there is a rust binding, maybe you can find examples here?
alex`` has quit [Quit: WeeChat 1.9.1]
faustinoaq has quit [Quit: IRC client terminated!]
rohitpaulk has joined #crystal-lang
<FromGitter>
<bararchy> @bew I looked around, already saw those ones, what I'm looking for is an actual end2end simple example like iris, etc.. So that I can get a feel for the proper flow of the lib
<FromGitter>
<bararchy> Maybe I'll ping Nvidia
unshadow has joined #crystal-lang
<FromGitter>
<bew> oh ok
<FromGitter>
<bararchy> After I get a simple example Like XOR working, I'll push it to git
<FromGitter>
<bararchy> :)
alex`` has joined #crystal-lang
<FromGitter>
<unreadable> anyone on linux willing to try an native java executable?
<FromGitter>
<unreadable> just wanna see if it's really standalone..
rohitpaulk has quit [Ping timeout: 255 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter>
<yxhuvud> no. get a virtual machine or something.
<FromGitter>
<bararchy> lol, what a shady offer XDE
unshadow has quit [Quit: leaving]
claudiuinberlin has joined #crystal-lang
<FromGitter>
<unreadable> getting a virtual machine only for this would be a good waste of time
<FromGitter>
<unreadable> and yeah, it's shady even from my pov
<FromGitter>
<unreadable> I've talked to a friend meanwhile, forget about it
<RX14>
@unreadable docker?
<FromGitter>
<Yive> so umm, I take that this chat can be used for support, right? (very new to this language)
<RX14>
yep
<RX14>
@Yive ask away
<FromGitter>
<Yive> So pretty much I'm having this weird issue with Kemal, not exactly sure if it's related to Kemal or just me not really knowing Crystal all that well. I essentially get the same error as this person, but for me it happens whenever I require my middlewares file. https://github.com/kemalcr/kemal/issues/393
<FromGitter>
<unreadable> ooo docker right, that's the best choice
<RX14>
@Yive could you gist your entire error message?
<FromGitter>
<Yive> well that's handy. thank you for the information, now I can finally fix this error which nearly made me quit & got back to php
<RX14>
@Yive what do you think could have made this experience easier for you?
<RX14>
I think error messages are too long...
<RX14>
putting the "error trace" behind a flag helped shorten errors but they're still often more than a page which is scary
<FromGitter>
<Yive> honestly, just a better footprint within google would of made it easier. Or maybe just a little note at the bottom of the error message saying that the last error listed is what you're supposed to be worried about
<RX14>
well I think that just removing everything else is the best idea...
<RX14>
Also what do you mean by a better footprint in Google?
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter>
<Yive> well, maybe a better footprint isn't really needed. I just couldn't figure out what the error meant from googling
<FromGitter>
<Yive> Maybe a page on understanding error outputs in the docs could of helped, but I'm probably one of a few who'd ever have this issue
<RX14>
Yeah
<RX14>
I think that's required
<RX14>
I think we probably loose a lot of people through
<RX14>
The first instinct is to look at the top of the error and try to understand it all
<FromGitter>
<bararchy> RX14, can't we switch the ord?
<RX14>
No because then everyone has to scroll
<RX14>
The bottom is the best place for the most relevant output
<RX14>
Because its the closest to the prompt
<FromGitter>
<bararchy> makes sense
<RX14>
We should have maybe 3 levels
<RX14>
Of error
<RX14>
And just cut the lest
<RX14>
Rest
<FromGitter>
<yxhuvud> I wonder if a short summary of the error should be added at top as well. perhaps it would make more people see the error when starting out.
<Papierkorb>
RX14: for type errors due to untyped methods the interesting lines are neither the last nor the first. Just hiding all of those would make fixing that common issue to become a minute-to-hour hunt instead of a 10-second-fix it currently is
<Papierkorb>
The huge macro expansions could be collapsed by default imho
<Papierkorb>
If not completely collapsed, maybe show a context of 2-lines-or-so around the interesting part of the macro.
<RX14>
Papierkorb: yes I know
<RX14>
I guess once we cast arguments
<Papierkorb>
yxhuvud, duplicating the message would make it ambigous what the last error was (is the first on the top or bottom?)
<RX14>
Once we cast arguments we can only show the trace since the last explicitly typed ancestor Papierkorb
alex`` has quit [Ping timeout: 255 seconds]
<Papierkorb>
Honestly, that's something we can teach where to look. In fact, the docs could dedicate a page to that. It should help those affected in the general case too, so that's a real win
<FromGitter>
<yxhuvud> papierkorb : Agreed. But it is definitely a pain point considering how many questions we get about it.
<Papierkorb>
I'm just trying to not duplicate data. Doing so imho improves the issue for the first time for newbies, and worsens the situations for everyone else. That can't be reasonable
<Papierkorb>
And also, why do people still scroll to the top in their terminals? Haven't they learned that the interesting part is at the bottom (of a single error) from almost any other compiler (those which are generally meant to be used manually from a console)?
<FromGitter>
<yxhuvud> I'm not certain it would be worse if done right. I mean, the summary of a academic paper also duplicates what is in the rest of the paper but it still adds somehting. It could be possible to do somehting like 'We got this error. This is how we reached it: [multiple lines]
<FromGitter>
<yxhuvud> Not everyone compiles in the terminal.
<Papierkorb>
Right, and those use some program that can know of this rule
<Papierkorb>
Compile errors can usually be easily reproduced locally if compiling on some CI explodes. And even reading a CI/compile log in a file, same rule applies as in the terminal.
<RX14>
On CI there's always buttons to go to the bottom
<Papierkorb>
Else, someone has an issue and posts it in some gist. Does the helper now have to do guesswork (or worse: ask) if that error was printed onto a TTy or not?
<RX14>
An error summary is fine but at the bottom
<Papierkorb>
isn't there one already?
<RX14>
No?
<Papierkorb>
like with the huge "you have to type your @ivar like this" error?
<jsn->
somewhere in newsgroups I think I saw it mentioned with "not fully implemented yet, thus undocumented" or something
<Papierkorb>
Can't remember, but I read on it in the docs. I've been using it since I've been using Crystal.
<Papierkorb>
Didn't you .. simply try the example?
<jsn->
no, but I assume it works; still, the lack of documentation and the notice above bother me, there might be all kinds of hard to catch issues with that
<jsn->
that's why I'm asking
mbarbar has quit [Ping timeout: 255 seconds]
<RX14>
nope its fully working
flaviodesousa has quit [Ping timeout: 260 seconds]
<FromGitter>
<JonnyCodewalker> is there a way to implicitly declare a variable inside times?, specifically talking about this bit of code: ⏎ ⏎ ``` total = 0 ⏎ 1000.times{|i| total += i if(i%3 == 0 || i%5 == 0)} ⏎ p total``` [https://gitter.im/crystal-lang/crystal?at=5a2ea7e3ba39a53f1a490d02]
<Groogy_>
I don't see any decleration?
<FromGitter>
<faultyserver> Not if you want the variable to be available outside of the block
<Groogy_>
you mean move the declaration into the code block?
<FromGitter>
<faultyserver> the only reason the block can access `total` is because it creates a closure that captures the existing `total` variable
<FromGitter>
<JonnyCodewalker> yeah, that is what i meant. @faultyserver i guessed so, but asking does not hurt
<FromGitter>
<faultyserver> of course :)
<FromGitter>
<JonnyCodewalker> ^^
<FromGitter>
<faultyserver> Is there a way to ensure that Array has a certain capacity?
<FromGitter>
<JonnyCodewalker> with .new you can specify an initial capacity, but afaik arrays are always dynamic
<FromGitter>
<faultyserver> yeah, I know you can `.push` and it will resize, but what I'm looking for is the ability to arbitrarily insert at a position
<Papierkorb>
And takes 5 minutes per file to compile?
<aroaminggeek>
unreadable: you can disable the subreddit them via sidebar option (I had to do the same with /r/crappydesign's comic sans abuse (intentional but got old 30 seconds in...)
<FromGitter>
<unreadable> I'm trying it right now, I like that it has a clean API which for c++ is pretty rare
<FromGitter>
<unreadable> I know there's options, but sometimes I just skip
<FromGitter>
<unreadable> 😄
Ven`` has joined #crystal-lang
faustinoaq has quit [Quit: IRC client terminated!]
<FromGitter>
<JonnyCodewalker> supposed i had a module named Test and a function named test that just returned 4. how would i create testcases with spec? I have read the documentation but I didn't really understand it :/
Ven`` has quit [Ping timeout: 240 seconds]
<jhass>
just create test_spec.cr, load your module and the spec stdlib, then do it "returns 4" do; Test.test.should eq(4); end; then crystal run test_spec.cr
aroaminggeek is now known as aroaminggeek[awa
<FromGitter>
<JonnyCodewalker> ok, thanks, got it :3 ...well after installing a missing library that is
Ven`` has joined #crystal-lang
<FromGitter>
<JonnyCodewalker> now to find out why `return 4` returns nil
<jhass>
so since run is an instance method but you call it as a class method I guess Admiral::Command makes some macro magic to define a class method of that name, which is what you call and what returns nil
csk157 has quit [Ping timeout: 240 seconds]
<FromGitter>
<JonnyCodewalker> tldr difference class and instance method? or where i can read about it?
<RX14>
because in the @arr.each call, el is an Array(String | Action)
<RX14>
so el[2] is a String | Action
<RX14>
and so doing el[2].call doesn't make sense
<RX14>
because you can't do "".call
<RX14>
it's not a method on String
<RX14>
the error message should tell you that @azbshiri
<RX14>
the solution is to use a Tuple(String, String, Action) instead of an Array(String | Action)
<RX14>
that way the compiler knows in which index is which type
<FromGitter>
<azbshiri> fair enough, thanks for the info.
<RX14>
so use {} instead of [] in the very inner array
<FromGitter>
<azbshiri> and I found a better way to that.
<RX14>
then Array({String, String, Action})
<RX14>
for arr
<RX14>
honestly this is a farly clean time
<RX14>
design*
<RX14>
i need more sleep
<FromGitter>
<paulcsmith> Y
<FromGitter>
<paulcsmith> Sorry. Accidentally typed that on mobile and can’t delete
astronavt has joined #crystal-lang
<jhass>
depending on your actual usecase having your macro render define a macro method or macro finished or something might work, in general have its output have a second run through the macro system