RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.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
<FromGitter> <aisrael> @graken, Crystal doesn’t have reflection (yet?), but in your case doesn’t `all = [] of X` work?
<FromGitter> <aisrael> @elorest Isn’t the command argument to `Process.run` just the first (string) argument?
<RX14> @elorest if you use IO::Memory you want to use Process.run without a block
<RX14> if you use process.run with a block then you want to leave input and output as-is and just use the existing pipes
<FromGitter> <elorest> Oh ok. I thought that the default options were false...
<RX14> the defaults are different for the block and not-block version
<RX14> a little confusing but makes sense
<FromGitter> <elorest> So is there a way to send to input and receive from output without closing input and output first. I'm trying to wrap a cli app. Using `irb` and `mysql` as examples.
<RX14> what do you mean by "wrap"
<FromGitter> <elorest> Sorry. By wrap I mean pass input to and recieve output from... for instance on irb if I passed "puts 'hello world'" I would expect that response to be in the output...
<RX14> yes but what do you do with that input and output
<FromGitter> <elorest> I like to be able to receive input and output without closing the process first. It seems like it would have to be possible.
<RX14> if it's just sending it to the commandline you can ignore all this and just inherit all
<RX14> and yes, of course you can handle input and output and error simultaneously
<RX14> but you;re doing things simultaneously which means fibers
<FromGitter> <elorest> Yeah definitely my initial code had fibers but I've tried to slim my example down until I get it working.
<FromGitter> <elorest> <RX14> I really appreciate you taking the time to look at this. Here is what I tried doing last night with a fiber to read from output. https://carc.in/#/r/3mx0
<RX14> well that should work when you just remove the IO::Memory stuff
<FromGitter> <elorest> Ok trying that.
<RX14> you have WAY too much bullshit in there though
<RX14> that `puts cmd.not_nil! if cmd` can just be `puts cmd`
<RX14> why did you even add it?
<FromGitter> <elorest> because I was getting an error about it only taking string instead of String | Nil.
<RX14> also your example is exactly the same as doing using input: Process::Redirect::Inherit, output: Process::Redirect::Inherit
<RX14> @elorest not with that code
<FromGitter> <graken> @aisrael only works for objects. I will use abstract classes :(
<FromGitter> <elorest> <RX14> ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I've modified it to that which uses the default output and input. Now it just hangs. I would expect the spawn to run on output.gets while waiting on standard in. [https://gitter.im/crystal-lang/crystal?at=5a93549e888332ee3acf8d06]
<RX14> @elorest have you tried with any other command that doesn't just hang?
<RX14> I mean that should work
<RX14> but i'm going to sleep
<FromGitter> <elorest> Just mysql and irb. Both of which I would expect to return output for given input...
<RX14> but why are you always trying to use interactive stuff
<RX14> you always test with something dumb
<RX14> make sure it works somewhat
<RX14> then move on to the advanced fancies
<FromGitter> <elorest> I can pass values into cat and return a value.
<RX14> just don't bother with stdin as all at first
<RX14> get stdout working
<FromGitter> <elorest> but if that's all I needed to do it's pretty easy just to run `cat filename`.
<RX14> but if all you're going to ever need to do is run a command transparently you can just use Process::Reditect::Inherit
<RX14> it's only if you need to actually have the string output in crystal that you need the other options
<FromGitter> <elorest> Ok I'll read into Redirect::Inherit.
<FromGitter> <elorest> Have a good night. This seems like it should be simple but I'm missing something I guess. I just wish I could see a working example of what I'm trying to do.
<RX14> it is simple usually
<RX14> because 99% of people either want: Process::Inherit, or IO::Memory without block
<RX14> because they either need to just run an interactive command for the user
<RX14> or they want to run a command and get the output/error into a single IO::Memory
<RX14> and that's simple
<FromGitter> <elorest> Yeah most things are. ⏎ ⏎ But not to write to input get the output and then write to input again I guess. :(
<RX14> well if that's all it is then you don't need to do much concurrently
rohitpaulk has quit [Remote host closed the connection]
<FromGitter> <elorest> I don't get what you mean. How could I let someone interactively work with an internal process if I didn't show the outputs when they happen. If I'm waiting for an input I need to show the output.
<FromGitter> <elorest> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a9357b7c3c5f8b90d054074]
<FromGitter> <elorest> Have a good night. I'll keep trying.
greengriminal has joined #crystal-lang
faustinoaq has joined #crystal-lang
relyks has joined #crystal-lang
relyks has quit [Quit: relyks]
<FromGitter> <elorest> Thanks. I got it.
hightower3 has joined #crystal-lang
hightower2 has quit [Ping timeout: 245 seconds]
rohitpaulk has joined #crystal-lang
vivus has quit [Quit: Leaving]
faustinoaq has quit [Quit: IRC client terminated!]
rohitpaulk has quit [Ping timeout: 245 seconds]
<FromGitter> <bew> @faustinoaq I'm going to make scry work with my neovim config, is there anything special about how to start the scry server? (I can't find any documentation about how to use it)
greengriminal has quit [Quit: Leaving]
<FromGitter> <bararchy> @bew
<FromGitter> <bew> hmm?
qard has joined #crystal-lang
<FromGitter> <bararchy> lol damn sorry, it pressed enter too fast
<FromGitter> <bararchy> anyway, I wanted to talk regarding the bluetooth socket addition
<FromGitter> <bararchy> I wantd to do it as a patch
<FromGitter> <bararchy> but it seems I can't reopen enums
<FromGitter> <bew> yeah I've seen your comment
<FromGitter> <bararchy> cool
<FromGitter> <bararchy> any suggestion for that?
<FromGitter> <bew> no idea
<FromGitter> <bew> ^^
<FromGitter> <bararchy> lol
<FromGitter> <bew> it feels weird that there is bluetooth stuff in libc
<FromGitter> <bararchy> well, Ruby has it
<FromGitter> <bararchy> and TBH it's less bluetooth stuff and more additional socket options
<FromGitter> <bararchy> :)
rohitpaulk has joined #crystal-lang
qard has quit [Quit: qard]
qard has joined #crystal-lang
<FromGitter> <bew> hmm that's *maybe* better then :) Your PR's name is tricky though, I think you should rename your issue/pr to show that "it is needed to have bluetooth stuff", not "hey I want bluetooth stuff IN ALL CAPS I need to change the stdlib", what do you think?
<FromGitter> <bew> @faustinoaq ... now I get it, every fancy things I see you're doing with crystal for vscode is only in your vscode plugin, I thought it was in Scry already! I was frustrated (and still ^^) for not being able to do a simple thing in another editor with scry only 😬
<crystal-gh> [crystal] MakeNowJust opened pull request #5750: Improve String#pretty_print output by splitting newline (master...feature/string/pretty-print) https://git.io/vArDa
<watzon> Can someone help me make this work? https://play.crystal-lang.org/#/r/3n2h
<watzon> Basically I want to store a class type (not an instantiated class) in a hash, where the type extends the class Base
<FromGitter> <bew> Use `Base.class` for the Hash's type
<watzon> Beautiful. I didn't know you could do that
<FromGitter> <aisrael> @watzon What’s the use case? In general, since Crystal doesn’t have reflection I’m not sure how much you can do with a `.class` at run-time. FWIW, I have similar code that calls the equivalent of `clazz = KNOWN_CLASSES[key]; return clazz.new`
<watzon> That's basically the idea. I have a `Hash(String, Hash(String, Hook.class))` that stores maps a hook type => context => hook class
<FromGitter> <aisrael> Right. So you just needed the `Base.class`
<watzon> Yup. Really I'm trying to port some Ruby code or I probably would have thought of a different way to do this.
<watzon> But I'm going to see if I can make this work
<watzon> Also, is it passible to forward a block to another method?
* watzon sent a long message: watzon_2018-02-26_06:23:11.txt <https://matrix.org/_matrix/media/v1/download/matrix.org/teshLSPFEEXiDKcGgjMQQaoQ>
<FromGitter> <aisrael> @watzon It’s possible to ‘capture’ blocks, store them to a variable, and call them later, yes. But you can’t change the receiver of the captured block (unlike with Ruby). There’s no `block.call` equivalent that works like how `with some_object yield` does
<watzon> That's what I thought. So the above code wouldn't be possible unless you were to pass the block in as a proc.
<FromGitter> <petoem> Actually, you can pass the block on to another method. ⏎ Like here: https://github.com/petoem/inotify.cr/blob/master/src/inotify.cr#L17 ⏎ But I don't know of a way to change the closured data.
<FromGitter> <aisrael> Yes, you can ‘forward’ the `&block` to another method call. It’s when you capture the block (as a Proc) that it’s not quite as dynamic (as in Ruby)
<FromGitter> <petoem> If I want to associate a certain block/proc to a object, I use https://crystal-lang.org/api/0.24.1/Proc.html#partial%28%2Aargs%3A%2AU%29forallU-instance-method ⏎ With `partial` you can fix the first argument to your object and then store the proc. ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5a93aaad35dd17022ef40408]
<FromGitter> <petoem> Its a bit hacky but it works.
<FromGitter> <aisrael> That’s quite a neat trick. I should try that some time
alex`` has joined #crystal-lang
qard has quit [Ping timeout: 252 seconds]
<watzon> Interesting. You can't have a block argument in a macro apparently, but if you call a macro with a block it doesn't throw
<FromGitter> <dc0d> Hi!
<watzon> Hello
<FromGitter> <dc0d> Is there a roadmap for Crystal somewhere?
<FromGitter> <bararchy> @dc0d you want something specific? Or just interested in the general direction ?
<FromGitter> <dc0d> To be specific the 1.0 milestone.
<FromGitter> <bew> @watzon yes you can have blocks in macros
<watzon> You can? How do you handle the yield? It threw an error when I tried
<FromGitter> <bew> try `{{yield}}`
<FromGitter> <bew> Or `{{the_block}}` if you gave it a name
<FromGitter> <bararchy> @dc0d *when its ready :)
<FromGitter> <bararchy> There is no real clear roadmap , there is general direction
<FromGitter> <bararchy> Parallelism, and Windows support
<FromGitter> <bararchy> Should be official v1.0
<FromGitter> <bew> @watzon and if you give it a name, you can access to some informations about the given block, like the number of block arguments, or the block's content, and do basic macro manipulations with them
<watzon> Second question. How do I get a TypeNode in a macro? Say I pass in the type `String` and I want to list its methods.
<watzon> I figured it out the other day and now I cant seem to do it again
<FromGitter> <bew> `var.resolve` (or `var.resolve?` depending on your need)
<FromGitter> <bararchy> ie. local var instead of instance
faustinoaq has joined #crystal-lang
<FromGitter> <petoem> yes, it should be `@path`
faustinoaq has quit [Quit: IRC client terminated!]
<FromGitter> <petoem> wait, what?
<FromGitter> <petoem> oh ok its a getter
Nik736 has joined #crystal-lang
<FromGitter> <dc0d> @bararchy :) 👍
rohitpaulk has quit [Ping timeout: 256 seconds]
<FromGitter> <bararchy> So it calls the getter ?
<FromGitter> <bararchy> That's weird right ?
<crystal-gh> [crystal] bararchy closed pull request #5746: Additional Socket Constants (master...master) https://git.io/vAr3O
LJNZXWZMB has quit [Ping timeout: 256 seconds]
<FromGitter> <philfine> Can a generic become a Proc ?
<hightower3> bararchy: someone told me that there is no particular difference between calling a getter and ivar directly
<FromGitter> <bararchy> it's just inconsistance across the lib, so no biggy
<Yxhvd> a generic what?
<FromGitter> <philfine> Just check the code
<FromGitter> <philfine> :)
<Yxhvd> see https://github.com/yxhuvud/cabbage/blob/master/src/cabbage/dsl.cr#L47 . It is a bit macroified to reduce signature repetition, but it should be possible to figure out
<FromGitter> <philfine> So it is really a syntactical thing
<FromGitter> <philfine> If defined with Proc(...) it works fine
<FromGitter> <philfine> How to decide when to use what ?
rohitpaulk has joined #crystal-lang
Bug2000 has joined #crystal-lang
A124 has joined #crystal-lang
A124 has quit [Ping timeout: 240 seconds]
Bug2000 has left #crystal-lang ["Leaving"]
A124 has joined #crystal-lang
A124 has quit [Ping timeout: 245 seconds]
return0e has quit [Read error: No route to host]
return0e has joined #crystal-lang
crystal-lang611 has joined #crystal-lang
crystal-lang611 has left #crystal-lang [#crystal-lang]
A124 has joined #crystal-lang
A124 has quit [Ping timeout: 276 seconds]
duane has quit [Ping timeout: 240 seconds]
shalmezad has joined #crystal-lang
jsn- has quit [Ping timeout: 240 seconds]
jsn- has joined #crystal-lang
jsn- has quit [Ping timeout: 245 seconds]
jsn- has joined #crystal-lang
elisaado has quit [Ping timeout: 240 seconds]
duane has joined #crystal-lang
elisaado has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
A124 has joined #crystal-lang
A124 has quit [Ping timeout: 240 seconds]
maattdd_ has joined #crystal-lang
A124 has joined #crystal-lang
maattdd_ has quit [Ping timeout: 256 seconds]
A124 has quit [Ping timeout: 248 seconds]
A124 has joined #crystal-lang
A124 has quit [Ping timeout: 240 seconds]
<FromGitter> <philfine> What is the best and ultra fast way to get time differences in milli-seconds, or even smaller?
<FromGitter> <philfine> Time ?
bonemind has joined #crystal-lang
bonemind has quit [Quit: WeeChat 2.0.1]
bonemind has joined #crystal-lang
A124 has joined #crystal-lang
A124 has quit [Ping timeout: 260 seconds]
bonemind has quit [Quit: WeeChat 2.0.1]
greenbagels has joined #crystal-lang
<greenbagels> So if I understand this correctly, since I can use C libraries via crystal's language bindings, crystal's lack of a parallel + concurrent threading mechanism doesnt matter if I can use libpthread, right?
<FromGitter> <bararchy> As long as you make all the threading logic behind in C
<FromGitter> <bararchy> :)
<FromGitter> <bararchy> basiclly if you implament all the threading, handeling, etc.. in C and just call `binding.do_magic` etc.. from Crystal it should be ok
<greenbagels> only writing threading in C is better than writing everything in C ;)
<FromGitter> <bararchy> true
<greenbagels> I shall try it
<greenbagels> I'm mainly curious about testing crystal in supercomputing environments
<FromGitter> <bararchy> send feedback my way, sounds interesting
<FromGitter> <bararchy> what for?
<greenbagels> yeah, that's definitely part of the motivation
<FromGitter> <bararchy> what is your field of research ?
<greenbagels> I'm currently involved in a research group that does fluid physics simulations in C/C++
<FromGitter> <bararchy> cool!
<FromGitter> <bararchy> Nvidia? XD
<greenbagels> but I'm getting kinda bored of writing C/C++ so a friend started advertising crystal
<Yxhvd> hmm. playing around with the linalg package. I wonder what LAPACKE.sgesdd returned -5 means.
<greenbagels> no, a university research lab, im a student
<FromGitter> <bararchy> oh, sounds really nice
<FromGitter> <bararchy> Yxhvd usually C libs return `< 0` status for failures
<FromGitter> <bararchy> there must be a error by number list in the docs or code
<FromGitter> <bararchy> you can usually "translate" those in strings via a method of some kind
<Yxhvd> Yes, it means argument number 5 is wrong, but doesn't say how, and as it is between lapack and the library I use, I have no idea what is actually going on
<FromGitter> <bararchy> greenbagels do you guys use GPUs for that?
<greenbagels> Yxhvd: check the 5th argument being passed
<greenbagels> bararchy, yeah, we use CUDA but we're playing around with other stuff
<greenbagels> I've gotten the liberty to test out using OpenCL, but I think AMD's linux drivers are messign with me...
<txdv> amd gfx on linux
<txdv> is horrible
<greenbagels> well their compute drivers
<FromGitter> <bararchy> Yxhvd well, I'm working on getting Bluez work with DBus and wrap it up with Crystal, trust me I would love getting a -5 error XD all I get is wierd "<@ay ()>" codes in return
<txdv> i dont know how can they mess it up so badly with open source drivers
<FromGitter> <bararchy> it's true, one of the reasons Nvidia controls the Linux gaming world
<FromGitter> <bararchy> as in, total control
<FromGitter> <bararchy> 98% of users
<FromGitter> <bararchy> according to Steam statistics
<greenbagels> they've apparently been trying to do something with a new driver stack that's open source cherrypicking from their amdgpu-pro drivers
<greenbagels> but the documentation is so, uh, incomplete
<greenbagels> or vague
<greenbagels> that it's hard to actually be sure what's going on
A124 has joined #crystal-lang
A124 has quit [Ping timeout: 240 seconds]
Nik736 has quit [Ping timeout: 276 seconds]
<RX14> lol it's the opposite
<RX14> amd drivers are way better on linux
<RX14> since they're open source and just work out of the box
<RX14> amd open source drivers trade blows to windows these days for gaming
A124 has joined #crystal-lang
A124 has quit [Ping timeout: 245 seconds]
alex`` has quit [Quit: WeeChat 2.0.1]
alex`` has joined #crystal-lang
<FromGitter> <liepaja> Hello everyone
alex`` has quit [Client Quit]
<txdv> RX14: my friend tried and nothing worked
<RX14> tried what?
alex`` has joined #crystal-lang
<RX14> the amd driver situation on linux has changed massively over the last year
<RX14> the old amd drivers used to be shit but easy to configure, or the closed source ones has better performance but were a huge pain to configure
<RX14> the new ones are both
<RX14> they're proper kernel modesetting and fully open source yet they're as good as the old closed drivers if not better for performance
<RX14> txdv, as long as you're using the new amdgpu drivers, everything should be pretty much flawless
A124 has joined #crystal-lang
A124 has quit [Ping timeout: 256 seconds]
cyberarm has quit [Ping timeout: 240 seconds]
cyberarm has joined #crystal-lang
A124 has joined #crystal-lang
A124 has quit [Ping timeout: 240 seconds]
<FromGitter> <r00ster91> hello. im using the sdl bindings shard for crystal. So when I do: ⏎ `require "sdl"` ⏎ and then run then it gives me this: ⏎ `/usr/bin/ld: cannot find -lSDL2` ⏎ so he is probably missing the SDL2.dll ... [https://gitter.im/crystal-lang/crystal?at=5a9454b48f1c77ef3a5a8ae6]
qard has joined #crystal-lang
A124 has joined #crystal-lang
A124 has quit [Ping timeout: 260 seconds]
<FromGitter> <bew> @r00ster91 You need to tell it where to search the library if it's not in standard places. For the current folder, set `LD_LIBRARY_PATH=.` before running the program, so for example `LD_LIBRARY_PATH=. ./your_binary`
<greenbagels> RX14: not for compute~
<RX14> ok sure
<greenbagels> but yeah i concede that it might be pushing it at that point
<greenbagels> given the progress on AMDGPU, I can't really complain about GPGPU not being bug free I guess
duane has quit [Remote host closed the connection]
duane has joined #crystal-lang
duane has quit [Ping timeout: 256 seconds]
Papierkorb has left #crystal-lang ["Konversation terminated!"]
qard has quit [Quit: qard]
qard has joined #crystal-lang
cpt_yossarian is now known as woodruffw
A124 has joined #crystal-lang
qard has quit [Quit: qard]
<FromGitter> <dbackeus_twitter> I find myself going from `IO` to `Bytes` quite a bit like this: ⏎ ⏎ ```bytes = Bytes.new(io.size) ⏎ io.rewind ⏎ bytes.read(io)``` ⏎ ⏎ It feels fairly clunky so was wondering if there is a cleaner way doing it? [https://gitter.im/crystal-lang/crystal?at=5a947648458cbde557cf9a38]
<watzon> Is it possible to use something like `self` in a macro? Say to get the current class's TypeNode
codenoid has joined #crystal-lang
<codenoid> hi, morning
<codenoid> it is safe to save a huge data into memory (Safe for GC ?) ?,
<FromGitter> <r00ster91> @bew I tried now: ⏎ `set LD_LIBRARY_PATH ./SDL2.dll`, ⏎ `set LD_LIBRARY_PATH SDL2.dll`, ⏎ `set LD_LIBRARY_PATH ./` ⏎ and then ... [https://gitter.im/crystal-lang/crystal?at=5a9478258f1c77ef3a5b97f5]
A124 has quit [Ping timeout: 248 seconds]
A124 has joined #crystal-lang
<hightower3> I see that one of constructors for Time is Time.new(year, month, day, hour = 0, minute = 0, second = 0, *, nanosecond = 0, kind = Kind::Unspecified)
<hightower3> But I have no success calling Time.new(1,1,1, 1,1,1, nil,0,Time::Kind::Unspecified)
<hightower3> It tells me wrong number of arguments for 'Time.new' (given 9, expected 0..6)
<hightower3> What's the catch?
<hightower3> Do I need to use named arguments?
A124 has quit [Ping timeout: 256 seconds]
<hightower3> yep, that did it
duane has joined #crystal-lang
<hightower3> I still can't understand the confusion made by removing Time#ticks...
<FromGitter> <dbackeus_twitter> (reposting with corrected code) ⏎ I find myself going from `IO` to `Bytes` quite a bit like this: ⏎ ⏎ ```bytes = Bytes.new(io.size) ⏎ io.rewind ⏎ io.read(bytes)``` ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5a947dfbe4ff28713acdf242]
<FromGitter> <bew> @r00ster91 try: `crystal build myfile.cr` then `LD_LIBRARY_PATH=. ./myfile`
A124 has joined #crystal-lang
<FromGitter> <bew> @watzon use `@type` in macros to get the current type's TypeNode
<watzon> Thanks @bew
<FromGitter> <bew> @dbackeus_twitter you can do `io.to_slice`
A124 has quit [Ping timeout: 252 seconds]
<codenoid> hi, how i can use cpp mmap in crystal ? whether to use bindings ?
<FromGitter> <bew> You can call `LibC.mmap` no ide what you mean by "cpp mmap" though
<codenoid> i'll try @bew
<FromGitter> <dbackeus_twitter> @bew thanks, not sure how I missed that one :)
shalmezad has quit [Quit: Leaving]
<codenoid> lol, it's nice to get more deep debugging crystal app with strace
codenoid has quit [Quit: i sleep in my keyboard]
A124 has joined #crystal-lang
elisaado has quit [Ping timeout: 248 seconds]
A124 has quit [Ping timeout: 252 seconds]
A124 has joined #crystal-lang
elisaado has joined #crystal-lang
<hightower3> A clean nice API of Time that was present in 0.23 is so terribly fucked up in 0.24
A124 has quit [Ping timeout: 240 seconds]
<FromGitter> <bew> did you read the issue/pr that changed that API?
<hightower3> Yes, and I still think it was bad to break things
<hightower3> Internal implementation details I can't comment on, but the API is terrible now, it's hard to re-create a Time from a Time, as well as undecidedness on milli/micro/nanoseconds, as well as it's harder to work with Time and Time::Span together
<FromGitter> <bew> you can always open an issue and restart discussion about this
<FromGitter> <bew> Anyone knows how `private alias` can be used? In 2 spec files, I have a `private alias ShortName = AVeryLong::Module::Name`, it works ok when running the spec files individually, but when I run all the specs with `crystal spec`, it fails with `alias ShortName is already defined`. What is the usecase if this doesn't work?
<RX14> is that private alias at the top level?
<FromGitter> <bew> yes
<RX14> darn
<RX14> sounds like a bug
<FromGitter> <bew> ok, I'll file an issue if you think so
<FromGitter> <bew> yes, more generally a toplevel private alias is not private (can be used from another file)
faustinoaq has joined #crystal-lang
A124 has joined #crystal-lang
A124 has quit [Ping timeout: 245 seconds]
<FromGitter> <philfine> @hightower3 What is so bad with Time ? Are values not acurate ? I am trying to use it to get msecs, so I kind of get it if that is the case
<hightower3> philfine: they values are accurate. I am referring to problems with severely destroyed elegance of the API
alex`` has quit [Ping timeout: 256 seconds]
<FromGitter> <philfine> Ok
<FromGitter> <philfine> Good to know, what do you recomend to use to get timestamps , as precise as possible
<FromGitter> <philfine> Is Time the best ?
<watzon> Is there a way to do this with instance variables? https://crystal-lang.org/docs/syntax_and_semantics/macros/fresh_variables.html
<watzon> I'm trying to make sure that the variables created by my macro won't clash with the instance variables in an extended class
<watzon> super class*
<FromGitter> <bew> well, you can probably use it for instance variable too (like https://carc.in/#/r/3ndv)
<watzon> Hmm, so you can do it with the getter/setter syntax
A124 has joined #crystal-lang
<watzon> But what about with the normal `@var : Type` syntax?
<FromGitter> <faustinoaq> > I'm going to make scry work with my neovim config, is there anything special about how to start the scry server? (I can't find any documentation about how to use it) ⏎ ⏎ @bew Yeah, you can try scry on neonim, last time I tried it, Neonim worked better than vim, ⏎ ⏎ ((http://i.imgur.com/hCWLtg9.png)) ... [https://gitter.im/crystal-lang/crystal?at=5a949a1953c1dbb7437edc86]
<FromGitter> <bew> yes or directly `@%var` @watzon
<FromGitter> <bew> Thank you @faustinoaq ! yeah I figured there were some nice work going on though, I subscribed (as a watcher) to the scry repo to follow updates, maybe I'll help too one day
A124 has quit [Ping timeout: 256 seconds]
<watzon> Crap. My problem seems to be trying to do it dynamically @bew
<watzon> `%` and `{` can't be put next to each other or it thinks I'm trying to make a string literal
<FromGitter> <bew> @faustinoaq ah nice, didn't about the gitter channel for scry :)
<FromGitter> <bew> @watzon, what you're doing here doesn't make sense
<watzon> All I really need to do is prefix each variable with a value that is going to be unique to that class
<FromGitter> <bew> the `var` bit in `%var` is just for you in the macro, there is no point in generating it
<FromGitter> <faustinoaq> > Yeah, you can try scry on neonim, last time I tried it, Neonim worked better than vim, ⏎ ⏎ s/neonim/neovim/ 😅 I was thinking on Nim dom96 👀
<FromGitter> <bew> yeah neovim is greaaat
<watzon> In ` #<ClassName:0x557b2ae97fe0 @__temp_20=0>` where does the `0x557b2ae97fe0` come from? And is there any way to access it in a macro?
<watzon> That's it's memory address isn't it?
<FromGitter> <bew> @faustinoaq I actually tried to make a neovim plugin in Crystal, but then other project took priority over it.. It so cool to just be able to do that
<FromGitter> <bew> @watzon no it's not possible, it is the address of the object in memory ===> not known at compile time
<FromGitter> <faustinoaq> 👍
<watzon> Right. Damn.
<watzon> All I'm trying to do is generate instance variables and make sure that those instance variables don't clash with instance variables in a parent class. I just need a random number that is unique per class.
<FromGitter> <bew> you could create a 'long' ivar like `@my_var_{{@type}}_blabla` where `blabla` would be an additional namespace or I don't know what, to make it unique.. But even if long names like this makes it verrry hard to have conflict, it can be quite ugly when the user wants to inspect the object..
<watzon> I guess this works https://carc.in/#/r/3nec
<watzon> Basically the same idea. I just want to make collisions unlikely
<FromGitter> <bew> note that `@type.id` is basically just the class's name