<FromGitter>
<marksiemers> nm, that doesn't have the same output. That is the commit where `ticks` was removed though.
<FromGitter>
<marksiemers> @sam0x17 - Is it for the amber code runner - the file naming?
<FromGitter>
<marksiemers> We started using this: `Time.utc_now.to_s("%Y%m%d%H%M%S%L")`
<FromGitter>
<marksiemers> That is not the same as ticks, but it is a slightly more readable timestamp than ticks, and it is precise to milliseconds
<FromGitter>
<marksiemers> It looks like ticks is here, it just depends on your use case how you calculate/use it: ⏎ https://crystal-lang.org/api/0.23.1/Time/Span.html#from%28value%2Ctick_multiplicator%29%3Aself-class-method
Yxhuvud has quit [Remote host closed the connection]
Yxhuvud has joined #crystal-lang
<Yxhuvud>
Also, topic should be updated.
afraeim has quit [Remote host closed the connection]
<Papierkorb>
That case equality stuff there doesn't look like type-safety. meh.
<FromGitter>
<bararchy> @mjago Thanks :)
<FromGitter>
<bararchy> we added a gitter chat to it also, if you need help
<FromGitter>
<bararchy> irprop is coming soon
<FromGitter>
<bararchy> @ArtLinkov is adding it as we speak XD
<FromGitter>
<bararchy> Oh, and Merry christmas everyone :)
<FromGitter>
<sdogruyol> @bararchy great job 👍
<FromGitter>
<bararchy> Thanks, but most of the job was done by @ArtLinkov
<FromGitter>
<ArtLinkov> Based on our tests, SHAInet is already much faster than the FANN-binded library (and that's with using only SGD + momentum) :)
<FromGitter>
<bararchy> because it's pure crystal, it wont halt the whole event loop either, so you can multi-task while it runs in the background
<FromGitter>
<bararchy> it's cool to see that in this scenario Crystal is faster then C
<FromGitter>
<mjago> Nice one @ArtLinkov ~ I’ve been having fun with crystal-fann!
<Papierkorb>
Does shainet wait on I/O?
<Papierkorb>
If not, it won't run "in the background".
<FromGitter>
<mjago> Oh and Merry Xmas all 🎅 :tara:
<FromGitter>
<mjago> 1) 🎉
<FromGitter>
<ArtLinkov> @mjago Thanks
<FromGitter>
<bararchy> Papierkorb it is in our regard, before we had C binding to FANN, and while it ran web (Kemal) would get unresponsive, now, it can both ran and show the web XD
<Papierkorb>
You already claimed it to be faster
<FromGitter>
<bararchy> Also, taking into account FANN's speed, we got it from 7 min a run to ~7 sec a run using SHAInet
<FromGitter>
<bararchy> I guess we can add Fiber.yeild in between EPOCHs so that is will release the event loop if needed
<Yxhuvud>
papierkorb: I would not mind a type safe case equality, given that case type checking would be smart enough to apply things like Class#=== smart enough.
hightower2 has joined #crystal-lang
<Papierkorb>
Yxhuvud: Class#=== already works, the point was that it needs to be (if at all) carefully crafted. I don't want array_of_ints.any?(/asd/) to compile.
<Papierkorb>
Because that predicate can never be true
<crystal-gh>
[crystal] MakeNowJust opened pull request #5452: Fix formatting multi assignment with newline after equal (master...fix/crystal-format/multi-assign-newline) https://git.io/vb7EK
<Yxhuvud>
papierkorb: I was thinking of cases like a : Int|String; case a; when String; a else a += 1; end should continue to work.
<Yxhuvud>
(well given that a actually has a value and not only a type :P)
<Papierkorb>
What's the difference? That already works
<Yxhuvud>
But would it continue to work if === for most stuff stops accepting whatever and returning nil in that case?
<Papierkorb>
It should, all methods that do type re-restriction are "special" already
<Yxhuvud>
sure, but I've never been in a situation to verify that case actually does that.
<Yxhuvud>
but if it does, then I certainly agree === should be tightened up.
<Papierkorb>
I'm not sure what do you mean? What's wrong with current #=== ?
<Papierkorb>
What doesn't it do what you want it to do?
<Yxhuvud>
well, you complained that it would be type unsafe to use it in the context of #any?, but the same is basically same with usage inside case statements.
<Papierkorb>
No I said that allowing to pass arbitrary types into #any? and friends is not a good idea
<Papierkorb>
classes and union types aren't usually stored in variables, so allowing those could be sane
<Papierkorb>
But not allowing an regex to be passed in on an array of int
<crystal-gh>
[crystal] MakeNowJust opened pull request #5453: Parse slash after open-paren as regex delimiter (master...fix/crystal/parse-slash-in-paren-as-regexp) https://git.io/vb7uU
<Yxhuvud>
yes, and you can totally do a similar things in case statments: case 5; when /xyz/; else; p :hi; end compiles just fine.
<Papierkorb>
case statements aren't easily comparable to those predicate methods
<Papierkorb>
cases are commonly static in structure, including their types
<Papierkorb>
Can't say the same about methods
<Papierkorb>
In fact, it doesn't make sense that a case on a Array(Int32) even compiles with regex branch
<Papierkorb>
It won't ever run, it can't ever run. That's dead code. The only point why to allow is to make it easy to write generic code
<crystal-gh>
[crystal] MakeNowJust opened pull request #5454: Fix to keep paren information for `to_s` on clone (master...fix/crystal/keep-keyword-info-on-clone) https://git.io/vb7z7
<FromGitter>
<HCLarsen> Hey guys, when working with the JSON.mapping macro, is it possible to get a property from the JSON object that's buried a layer or two within the object, instead of just top level values?
<oprypin>
HCLarsen, if those subobjects are also mapped and specified as part of the top level one
<oprypin>
or specify different root for json.mapping
<oprypin>
uh wait, i think root is specified when parsing
<FromGitter>
<HCLarsen> When you say subobjects being mapped and specified as part of the top level one, what do you mean?
<FromGitter>
<HCLarsen> Here's my code example if it helps. I'm trying to get the "temp" property, which is within the "main" subobject.
<FromGitter>
<bararchy> how do I do the reverse of Char.ord ? as in turn Int to Char via ASCII mapping
<FromGitter>
<bararchy> Oh, Int#chr
<FromGitter>
<bararchy> XD
snsei has joined #crystal-lang
faustinoaq has joined #crystal-lang
hightower2 has quit [Ping timeout: 260 seconds]
hightower2 has joined #crystal-lang
A124 has quit [Read error: Connection reset by peer]
A124 has joined #crystal-lang
snsei has quit [Remote host closed the connection]
WeirdGuest has joined #crystal-lang
Poeticide is now known as Poeticode
WeirdGuest has quit [Quit: Page closed]
DTZUZO has joined #crystal-lang
cremes has quit [Quit: cremes]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
ylluminate has joined #crystal-lang
yllumina_ has joined #crystal-lang
ylluminate has quit [Ping timeout: 268 seconds]
<FromGitter>
<Jens0512> If you guys were to make a simple program like `crystal-cd ...`- simply doing just the same as `cd ...` what do you think you would do?
snsei has quit [Remote host closed the connection]
<Papierkorb>
`crystal init app my-ls` would be a good starting point.
<Papierkorb>
Note that cd can't even be a program by itself, your example is too simple and can thus lead to confusion.
<Papierkorb>
Jens0512, What are you actually trying to do? Please don't simplify the problem, it has too often lead to confusion on both sides and resulted in inferior solution recommendations based on that.
snsei has joined #crystal-lang
<FromGitter>
<marksiemers> @Jens0512 - It wouldn't actually be doing anything, but you could use backticks to execute `cd` and use `ARGV` to pass along the command.
<FromGitter>
<marksiemers> Based on "doing the same this as `cd ...`" - that should work
hightower2 has quit [Ping timeout: 256 seconds]
snsei has quit [Remote host closed the connection]
<FromGitter>
<straight-shoota> @sam0x17 what do you need `ticks` for? It was an implementation detail that shouldn't have been useful for anything before it was removed.
faustinoaq has quit [Quit: IRC client terminated!]
faustinoaq has joined #crystal-lang
<FromGitter>
<marksiemers> @straight-shoota - I'm not sure if this is what @sam0x17 is looking to correct, but he did use it for `amber exec` - which creates log files. `ticks` was used for ensuring uniqueness. ⏎ If that's what he's looking into now, I think a timestamp for the file will work better.
faustinoaq has quit [Ping timeout: 268 seconds]
<FromGitter>
<marksiemers> Nm, it looks like `Time.now.epoch_ms` was used there. I'm not sure what his use case is. ⏎ I couldn't figure out exactly what ticks was, did it represent any measure of time?
<FromGitter>
<straight-shoota> `Time` was using it internally as measurement of time, where each tick represented a specific amount of milliseconds.
<FromGitter>
<marksiemers> Ah, is it used instead of nanoseconds (or microseconds) to support a larger range of time while being more precise than milliseconds?
<FromGitter>
<marksiemers> As well as the meta-info in the higher bits
<FromGitter>
<straight-shoota> basically, yes
<FromGitter>
<marksiemers> In hindsight, it should have been a private or protected method all along?
<FromGitter>
<straight-shoota> yes
<FromGitter>
<straight-shoota> It didn't make much sense to use it. The improved precision over `epoch_ms` is just one order of magnitude and it would certainly not work now that time has nanosecond precision.
<FromGitter>
<straight-shoota> If we had kept the concept of uing ticks internally with nanoseconds, each tick might now amount to a nanosecond or something
<FromGitter>
<straight-shoota> it wouldn't have been guaranteed to be 1 tick == 10 ms
<FromGitter>
<straight-shoota> but ticks were completely removed anyway because they didn't make much sense
<Papierkorb>
ticks were defined in terms of constants, that was never an issue
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter>
<straight-shoota> It might have been, if you just used the plain number returned by `ticks`
<FromGitter>
<straight-shoota> it wasn't supposed to be used outside the implementation of `Time` and `Time::Span` and even for that it wasn't really useful.
<FromGitter>
<straight-shoota> Could have used miliseconds directly like we now have seconds and nanoseconds
<FromGitter>
<marksiemers> @sam0x17 - If you're around today, let us know what your use case for ticks was/is. I'm curious (if it is something other than time-stamping files).
<FromGitter>
<Jens0512> @marksiemers `\`cd #{wherever}\``would not do anything useful at all as it would be done in a new process. How could i make it so calling the program in a terminal would actually cd in that terminal?
<FromGitter>
<Jens0512> (And thanks for answering)
<FromGitter>
<Jens0512> Even if you do not see this message for a long time, please tag me with a reply if you have any.
bijan_ has joined #crystal-lang
bijan_ is now known as bijan_awaaaay
bijan_awaaaay has quit [Client Quit]
<FromGitter>
<marksiemers> As previously mentioned, I think more context will help here - why do you need to change directories in the terminal using Crystal?
<FromGitter>
<Jens0512> I do not need to. I simply want to know how to
<Papierkorb>
Jens0512, Why haven't you looked yet into the docs?
<Papierkorb>
Chaning directories has something to do with Directories, so it'll be in Dir.
<FromGitter>
<Jens0512> I have, but i can't find anything regarding it.
<FromGitter>
<Jens0512> The Dir.cd does not change directory in the shell the program is called in does it?
<Papierkorb>
Why exactly shouldn't it? Have you tried it?
cremes has joined #crystal-lang
<FromGitter>
<Jens0512> Yes, and it does not work
<Papierkorb>
Why haven't you posted the code you're having issues?
<FromGitter>
<Jens0512> Now i have: `Dir.cd ENV["HOME"]`
<Papierkorb>
And further?
<FromGitter>
<Jens0512> This is it currently. This is what i do not manage
<Papierkorb>
What have you tried to put after that line?
<FromGitter>
<Jens0512> Couple of other stuff, but i do not see why it matters
<FromGitter>
<Jens0512> ~~stuff~~ *things
<Papierkorb>
Look. We *want* to help. Like, really we want to. Many in here love it. That's why we're here.
<Papierkorb>
But for that, the helpee has to help the helper to receive help themselves.
<oprypin>
geez just stop
<oprypin>
Jens0512, it is literally impossible for a process to affect the current directory of the parent process
<FromGitter>
<Jens0512> Oh ok
<oprypin>
too bad i couldn't save you those 3 hours :/
<FromGitter>
<Jens0512> Thats too bad
<Papierkorb>
Everyone could have, if that would've been the question
GoldenBear has quit [Quit: bai]
<FromGitter>
<Jens0512> Sorry for wasting your time ⏎ Ill be more clear next time
<oprypin>
i don't know what wasn't clear, that was just feigning ignorance
<oprypin>
> make a simple program like `crystal-cd ...`- simply doing just the same as `cd ...`
<oprypin>
if you don't know what `cd` does, try `man cd`
<oprypin>
its secret is that it must be implemented in the shell itself and can't be an external process
GoldenBear has joined #crystal-lang
<FromGitter>
<marksiemers> @Jens0512 - Please feel free to ask other questions. In general, it is easier with a bit of context and an end goal in mind. ⏎ For example: ⏎ ⏎ > I need to change directories based on user input so that custom config files can be used to execute the program, and the user can store those files in arbitrary directories. ⏎ > So far I have this code `...` (or link to a gist), this is what is happening:
<FromGitter>
<marksiemers> Thanks for your interest.
cremes has quit [Quit: cremes]
alex`` has quit [Quit: WeeChat 2.0]
<FromGitter>
<barisbalic> I'm trying to cross-compile for the first time and have some questions, first off, the command that `--cross-compile` generates for me looks a bit odd... `cc 'test.o' -o 'test' -rdynamic -L/usr/local/lib -lSDL2 -lpcre -lgc -lpthread /Users/barisbalic/.anyenv/envs/crenv/versions/0.23.1/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/lib -L/usr/local/lib` it seems to reference a bunch of things local to my
<FromGitter>
... machine, including `libcrystal.a`, is it expected that this file exists somewhere on the target?
<vanbuur740>
▄▄▄▄▄▄▄▄▄▄▄▄ HAPPY NIGGER MAS!! IF YOU WANT JOIN A CELEBRATION THAT IS NIGGER FREE PLEASE JOIN #/JOIN RIGHT HERE ON THIS NETWORK!! tsdhryy: pabs foca pleiosaur fiete avdi justinmcp hightower3 lvmbdv mroth SuperChickeNES hightower2 swav FromGitter dostoyevsky DTZUZO asterite tliff hmans A124 DTZUZU Papierkorb ephem
<vanbuur740>
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ HAPPY NIGGER MAS!! IF YOU WANT JOIN A CELEBRATION THAT IS NIGGER FREE PLEASE JOIN #/JOIN RIGHT HERE ON THIS NETWORK!! agnkqa: danzilio bmcginty jfontan hightower2 maxpowa binBASH aarongodin ua_ SuperChickeNES hightower3 li
<vanbuur740>
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ HAPPY NIGGER MAS!! IF YOU WANT JOIN A CELEBRATION THAT IS NIGGER FREE PLEASE JOIN #/JOIN RIGHT HERE ON THIS NETWORK!! pjiwchrd: mjblack Vexatos hmans dostoyevsky asterite andersh binBASH ua_ foca hightower2 Yxhuvud ashirase _whitelo
<vanbuur740>
▄▄▄▄▄▄▄▄▄▄ HAPPY NIGGER MAS!! IF YOU WANT JOIN A CELEBRATION THAT IS NIGGER FREE PLEASE JOIN #/JOIN RIGHT HERE ON THIS NETWORK!! ykaugu: foxxx0 Majost pleiosaur Vexatos cremes bmcginty Yxhuvud A124 shelvacu literal justinmcp Papierkorb TIMEBONEZ dostoyevsky hightower3 binBASH alex`` ashirase maxpowa foxbot andrewzah salvor fiete as
<vanbuur740>
▄▄▄▄▄▄▄▄▄▄ HAPPY NIGGER MAS!! IF YOU WANT JOIN A CELEBRATION THAT IS NIGGER FREE PLEASE JOIN #/JOIN RIGHT HERE ON THIS NETWORK!! tbtzjdr: dostoyevsky tliff foxbot jeromegn asterite Majost lvmbdv pleiosaur andersh maxpowa faustinoaq binBASH SuperChickeNES foxxx0 DTZUZO hmans shelvacu jhass ephemera_ danzilio swav jfontan hightower2
vanbuur740 has quit [K-Lined]
<FromGitter>
<greenbigfrog> who doesn't love the freenide spammers
<FromGitter>
<bararchy> :\
<FromGitter>
<fridgerator> ugh
<FromGitter>
<HCLarsen> WTF???
<FromGitter>
<drosehn> Note that the `cd` question might be fueled by the fact that there *is* a `cd` command in unix. As you might expect it is pretty worthless, however it does exist and it is defined by POSIX. So if someone looks under `/usr/bin` for some easy command to re-implement in crystal, they might be fooled by the fact that a `cd` command exists there.
<oprypin>
bash: /bin/cd: No such file or directory
<FromGitter>
<drosehn> `type -a cd`
<FromGitter>
<HCLarsen> Hey @oprypin can you please elaborate on your earlier statement about my JSON.mapping issue? How do I access a property within a subobject of the JSON object I'm mapping?
<FromGitter>
<HCLarsen> For example, I want the "temp" value that's within the "main" subobject. How would I fix the code on the line for temp to get that value?
<oprypin>
ehhhh
<jsn->
debian, gentoo, centos and ubuntu i've checked don't seem to have (/usr)/bin/cd; surprisingly, freebsd does have it, though
<oprypin>
HCLarsen, maybe you don't wanna use json.mapping
<oprypin>
j["main"]["temp"].as_f so easy
<FromGitter>
<HCLarsen> No?
<FromGitter>
<drosehn> freebsd is where I remember it from, actually. long ago we had a discussion as to why do we bother to have it, and the answer was "because POSIX says it's there".
<FromGitter>
<HCLarsen> Ohhh. Well that's what I did the first time around. Resulted in lots of boilerplate code.
<FromGitter>
<HCLarsen> I was hoping that json.mapping would help me slim down the code.
<FromGitter>
<HCLarsen> @oprypin so I do have to create a struct within my parent class for each subobject within the JSON that I'm parsing.
<oprypin>
yes
<FromGitter>
<HCLarsen> Ok. I was hoping there'd be a way around that, but at least I know there isn't.
<FromGitter>
<HCLarsen> Now I just have to decide if I want to do that, or stick with the manual approach of `["main"]["temp"].as_f` for all the properties I'm extracting.
<FromGitter>
<HCLarsen> It is a bit ugly, it does what I want, but I'd want to access it as "temp" instead of as "main." I'm also going to want to extract the other properties within the "main" subobject.
<jsn->
then yes, you should create a separate mapping for the subobject, obviously
<oprypin>
this is a huge hack and defeats the point.
<oprypin>
dont forget forward_missing_to
<jsn->
if it's a hack, it's a hack in JSON.mapping, though
<jsn->
but yeah, not gonna win any beaty contests
<FromGitter>
<HCLarsen> Yeah, I was originally thinking that json.mapping would make the code cleaner than what I've currently got, but it seems that this is just as complicated.
<FromGitter>
<HCLarsen> In the macro example you gave me, I'd have to type out all the methods manually, but that would give me an option to get that list without so much typing.
<oprypin>
certainly
GoldenBear has joined #crystal-lang
<hightower2>
Looks like channel title should be updated to mention 0.24.1
<FromGitter>
<HCLarsen> Is 0.24.1 available for all platforms?
<FromGitter>
<HCLarsen> When I asked, I was told that you can only get it by compiling from source.
<oprypin>
HCLarsen, that was true when you were told that
<oprypin>
v0.24.1 tag appeared 10+ days ago, binary releases appeared ~2 days ago
<FromGitter>
<HCLarsen> Ahhh. So is there an Ubuntu package then?
<oprypin>
probably
<FromGitter>
<HCLarsen> Good, good.
<FromGitter>
<Jens0512> So no way to execute an executable in a crystal executable parent process
<oprypin>
Jens0512, whaaaaaaaat
<FromGitter>
<Jens0512> Thought for a second that `Process.exec "an-executable"`would work, but apparently not
<FromGitter>
<HCLarsen> Wow, I don't know how to execute that statement. :D
<oprypin>
now we definitely have no idea what you're talking about, you just started the conversation with a very vague and probably false statement
<FromGitter>
<HCLarsen> I think I saw something about this earlier in this chat, so please jog our memory @Jens0512
<FromGitter>
<drosehn> You couldn't force it to happen. If the parent process is something that you're writing, then you could set up something where the child process writes a command which the parent reads in.
<FromGitter>
<drosehn> so, if the parent process was a shell, and you typed in: `eval "$(your_crystal_pgm)"`, then that'd probably work. ... assuming I've typed that in correctly.
<RX14>
but if you push tags and commits at the same time
<oprypin>
the only thing travis is good at is providing free hardware
<RX14>
it does
<RX14>
:ok_hand:
<RX14>
we need to enable building tags properly
<RX14>
and we need to fix the CI script to strip the new v prefix for versions too
<RX14>
i've been putting off thinking about it
<FromGitter>
<HCLarsen> 1) 24.1 also doesn't show up yet on play.crystal-lang.org.
<oprypin>
that's a whole another deal
<oprypin>
i still disagree with the "play.crystal-lang.org" alias
<oprypin>
just use carc.in
<oprypin>
the reason that i bring this up is that Manas does not manage this service
<hightower2>
I have a macro as part of which I create a "def" in the following form: def somefunc({{ call.args.splat }}) : Bool. Now, in that method, I need to access the value of first argument. How do I do that given that I don't clearly see what the argument names are?
<oprypin>
call.args[0] i dunno
<oprypin>
first time i see .splat being used
<oprypin>
there's a syntax for it {{*["a", "b"]}}
<oprypin>
aha it's literally rewritten to that.splat, same for ** that.double_splat
<hightower2>
oprypin, {{ call.args[0] }} seems to expand to literal "name : String", rather than just "name"
<oprypin>
hightower2, the result of it is a value of type Arg, hopefully you can figure out what to do with that
<oprypin>
you say it expands to that. that's true, but only because you didnt do anything else with it