<FromGitter>
<aisrael> Am seeing (what to me seems) weird behaviour with double splats, `NamedTuple` and Proc. It seem some local variable and double splat/parameter name interference is happening
<FromGitter>
<aisrael> I'd just like to know whether I should raise it as an issue, thanks.
<FromGitter>
<asterite> You are passing Int32 as an argument
<FromGitter>
<aisrael> Yes, but inside the `->` I create a new local variable `id` which *should* take scope precedence, right?
<FromGitter>
<aisrael> If I rename either the "inner" or "outer" `id` to something else, it works fine.
alex``` has joined #crystal-lang
akaiiro has quit [Ping timeout: 265 seconds]
akaiiro has joined #crystal-lang
alex``` has quit [Ping timeout: 240 seconds]
akaiiro has quit [Ping timeout: 240 seconds]
akaiiro has joined #crystal-lang
<FromGitter>
<Timbus> Not making a new var, more like 'reassigning' one. I guess because it is a closure, it determines that it therefore 'might be' one type or the other, which .. could that happen if threads got involved?
<FromGitter>
<asterite> id: Int32, you are passing the class type Int32
<FromGitter>
<asterite> You should just pass id: 1 or something like that
<FromGitter>
<Timbus> he is reassigning id before the second call
<FromGitter>
<asterite> Ah, got it. But yeah, there's a bug already reported for that
<FromGitter>
<Timbus> but yeah, captured var problem
akaiiro has quit [Ping timeout: 244 seconds]
akaiiro has joined #crystal-lang
akaiiro has quit [Ping timeout: 240 seconds]
akaiiro has joined #crystal-lang
<FromGitter>
<aisrael> It's a known issue, got it. Anyway the actual code ended up not having said issue, just thought it was a curious issue
<crystal-gh>
[crystal] MakeNowJust opened pull request #6377: http: support serving wasm by StaticFileHandler (master...feat/support-wasm-static-file-handler) https://git.io/fNqmf
alex``` has quit [Quit: WeeChat 2.1]
<FromGitter>
<vivus-ignis> oh got it, @aisrael. thank you
alex``` has joined #crystal-lang
<FromGitter>
<giuseongit> Hi, how do I use the `expand` tool?
<FromGitter>
<giuseongit> `crystal tool expand [filename]` does not work
duane has quit [Ping timeout: 248 seconds]
duane has joined #crystal-lang
alex``` has quit [Ping timeout: 240 seconds]
alex``` has joined #crystal-lang
<FromGitter>
<simenge> guys i'm trying to install crystal on windows and having issues
<FromGitter>
<simenge> apparently the repository is "insecure" or cant be found
<FromGitter>
<simenge> following the official guide
<crystal-gh>
[crystal] asterite opened pull request #6378: Fix: named arguments expanded from double splat clash with local variable names (master...bug/5693-double-splat-local-var-conflict) https://git.io/fNqBT
<FromGitter>
<jspillers> I just love when I think to myself "I wonder if crystal works this way..." and then I try out my idea in a little test file. Viola - works exactly how I would have expected. Testament to a very well thought out lang - thanks again creators and maintainers!
<FromGitter>
<asterite> :-)
<FromGitter>
<asterite> It's actually the feeling I had when I started coding in Ruby, so I guess that's why it happens
<FromGitter>
<jspillers> yes!
<FromGitter>
<simenge> If anyone else has trouble installing crystal on windows, after 2 hours i finally found a solution
<FromGitter>
<jspillers> I know a bunch of rubyists and they are all getting sick of me going on about crystal
<FromGitter>
<jspillers> but eventually they will submit
<FromGitter>
<simenge> then fucking "sudo su" to get the right permissions to modify the right files
<FromGitter>
<simenge> But at least it's working now
<FromGitter>
<simenge> Official instructions do not work right now
<FromGitter>
<Daniel-Worrall> Official instructions have worked for me on WSL the last 5 times I did it
<FromGitter>
<Daniel-Worrall> You definitely don't need to`sudo su`
<FromGitter>
<Daniel-Worrall> What exactly did you run and what exactly did it return
<FromGitter>
<simenge> wait a sec
<FromGitter>
<simenge> here's my epic tale. forgive the ranty tone, i genuinely appreciate the crystal team and its entirely possible the mistake is mine. also note i omitted some steps i tried because i tried so many times, different combos of commands with and without sudo, etc
<FromGitter>
<simenge> so might be hard to navigate
<crystal-gh>
[crystal] asterite opened pull request #6379: Parser: don't use invalid internal names for arguments like `@select` or `@@select` (master...bug/5997-invalid-internal-names) https://git.io/fNqah
<FromGitter>
<simenge> Someone told me the lack of dirmngr might be the root of a lot of problems. Doesn't come with the default ubuntu on windows and not mentioned in the docs. So might be an idea to add that in there.
<FromGitter>
<straight-shoota> @simenge It seems installing dirmngr might not be the solution
<FromGitter>
<straight-shoota> see Microsoft/WSL#3286
<FromGitter>
<simenge> Yeah I saw your post on reddit.
<FromGitter>
<r00ster91> I recommend using an older Ubuntu version for WSL
<FromGitter>
<straight-shoota> It's an issue with Ubuntu 18.04 on WSL
<FromGitter>
<r00ster91> Ubuntu 16.04
<FromGitter>
<simenge> Damn.
<FromGitter>
<simenge> Oh well, ordeal's over, now i can start coding!
<FromGitter>
<straight-shoota> that's the important thing π
<FromGitter>
<simenge> I can't get over the fact that the only way to gain superuser access is sudo su
<FromGitter>
<simenge> like, couldn't they let me create an actual admin password
<FromGitter>
<simenge> But that's not a Crystal issue obviously
<FromGitter>
<j8r> you can just use su
<FromGitter>
<straight-shoota> better `sudo -i`
<FromGitter>
<simenge> can't use su on ubuntu on windows, as far as i can tell
<FromGitter>
<j8r> i don't like sudo, I usually use directly su. sudo had some vulnerabilities in the past, like bash
<FromGitter>
<simenge> when you install a proper linux you pick an admin password in the install process
<FromGitter>
<simenge> not so here
<FromGitter>
<straight-shoota> I think it's bad practice to walk around as root user doing ordinary things
<FromGitter>
<simenge> It is
<FromGitter>
<straight-shoota> `passwd` ?
<FromGitter>
<j8r> you do as user, and then root when doing system things - simple as that
<FromGitter>
<straight-shoota> the installer doesn't configure any of this for you, but that doesn't mean you can't change it yourself
<FromGitter>
<j8r> i think you can be root
<FromGitter>
<j8r> I'm sure you can, i had installed apt packages in WSL before
<FromGitter>
<simenge> It's been so long since I used a native Linux, I'd forgotten all about passwd
<FromGitter>
<drum445> Is there a way to list the vars a class' init function requires?
<FromGitter>
<drum445> So I can dynamically initialise a class
<crystal-gh>
[crystal] felixbuenemann opened pull request #6380: Fix compilation with LLVM 6.0.1 (master...llvm-6.0-support) https://git.io/fNq1u
<FromGitter>
<asterite> the word "dynamic" doesn't go very well with crystal
<FromGitter>
<drum445> It doesn't seem to have very good reflection
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
wontruefree has quit [Quit: bye]
<FromGitter>
<drum445> Any ideas how I can improve this my friends: https://github.com/drum445/objectify? β I'm not liking the fact every field of the class needs to be nillable currently but not sure how to avoid it ;(
wontruefree has joined #crystal-lang
ua has quit [Ping timeout: 264 seconds]
<FromGitter>
<bew> Did you look at how json mapping works? (or JSON::Serializable now)
<FromGitter>
<drum445> hmm seems I may be concerned over nothing, JSON:Serializable docs say to have either union type with nil or a default value. β Maybe it is just different for me but it seems strange to have every attr in your class as ```attr : String?```
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 264 seconds]
Raimondii is now known as Raimondi
<FromGitter>
<asterite> Ed: just traverse all instance vars in the constructor. If an instance var is not nilable and doesn't have a default value, and you can't find it from the result set from the db, just raise an exception. That's how JSON deserialization works in Crystal, except it reads the fields from a JSON string instead of a DB
<FromGitter>
<drum445> @asterite cheers, but I couldn't find a way to loop through instance vars without firstly initialising the class?
<FromGitter>
<drum445> Also you can't even have a class without a constructor that inits them or a default value
<FromGitter>
<asterite> Right, you can only look through instance vars inside a method, never outside a method
<FromGitter>
<asterite> Maybe it's better to use another language, like Ruby, if you need that kind of dynamism
<FromGitter>
<drum445> Cool, so can I just ask you, do you think it makes my lib bad that each class attribute needs to be nillable for it to work? β Or is that how Crystal is and I'm too used to other lanaugaes
<FromGitter>
<drum445> cause tbh, if you're class has β include JSON::Serializable β then it works fine lol :)
wontruefree has quit [Quit: bye]
<FromGitter>
<asterite> Well, if it works for JSON, there must be a way for it to work with what you are doing
<FromGitter>
<asterite> (but I don't have time to look at the code right now)
wontruefree has joined #crystal-lang
<FromGitter>
<asterite> it's just that macros are a bit messy sometimes, and hard to get, and there are some rules regarding them that don't apply elsewhere...
rohitpaulk has quit [Ping timeout: 256 seconds]
moei has quit [Quit: Leaving...]
<FromGitter>
<HCLarsen> Hey guys, help me out here. What's that command that lets you see the code generated by your macros?
<FromGitter>
<aisrael> @ed Youβll want to learn macros if you want to introspect a class, and only at compile-time
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
<FromGitter>
<asterite> HCLarsen: just put {{debug}} right at the end of a macro. It's the simplest way.
<FromGitter>
<talbergs> well most likely, thanks. Thou im curious how the other way of file watching works. Some kind of sys(os) event is being emitted or so... β β @Blacksmoke16 how did you imagined it? β β ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b491ec8897d514b3c4c7b19]
<FromGitter>
<Blacksmoke16> prob something like that
<FromGitter>
<Blacksmoke16> thats a total guess tho not doing anything with file watching before :P
moei has joined #crystal-lang
<FromGitter>
<drum445> I've just decided that my lib will require json and use their init builder as it would just be all duplicated code anyway I think
<FromGitter>
<drum445> Seems to work well
wontruefree has joined #crystal-lang
wontruefree has quit [Client Quit]
<FromGitter>
<talbergs> @Blacksmoke16 I looked up, `File.info` uses `LibC.lstat` and returns it wrapped in new this: `src/crystal/system/unix/file_info.cr`. As far as I see, I must call `File.info("./conf.json")` on every poll.
<FromGitter>
<Blacksmoke16> π gotcha
<FromGitter>
<Blacksmoke16> makes sense
<crystal-gh>
[crystal] RX14 closed pull request #6378: Fix: named arguments expanded from double splat clash with local variable names (master...bug/5693-double-splat-local-var-conflict) https://git.io/fNqBT