RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.25.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
wontruefree has quit [Quit: bye]
phase__ has joined #crystal-lang
phase__ has quit [Client Quit]
phase__ has joined #crystal-lang
phase__ has quit [Client Quit]
phvse has joined #crystal-lang
<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> Minimal example here: https://play.crystal-lang.org/#/r/4i88 ⏎ Can anyone help explain what's going on?
<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
DTZUZU2 is now known as DTZUZU
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
akaiiro has quit [Ping timeout: 240 seconds]
akaiiro has joined #crystal-lang
akaiiro has quit [Ping timeout: 260 seconds]
akaiiro has joined #crystal-lang
alex``` has joined #crystal-lang
ashirase has quit [Ping timeout: 244 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
ashirase has joined #crystal-lang
marius has quit [Ping timeout: 256 seconds]
marius has joined #crystal-lang
<FromGitter> <vivus-ignis> Hi! I'm trying to compile a simple sketch with a single module definition and a main method in it. On 'crystal run' I'm getting 'undefined method': https://gist.github.com/vivus-ignis/d42515115bbef79599ef356b6ba77096 Why is that?
<FromGitter> <aisrael> `main` is an "instance" method, not a class/module-level method
<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> <simenge> needed to do curl -sL "https://keybase.io/crystal/pgp_keys.asc" | sudo apt-key add
<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> It sounds angry but I swear I don't mean to offend anyone, just a bit frustrated
<FromGitter> <simenge> Big problem was I could not get the key and repository installed. And I tried everything on the official doc page
<FromGitter> <Daniel-Worrall> Are you using Ubuntu on WSL?
<FromGitter> <simenge> yes and yes
<FromGitter> <Daniel-Worrall> It's difficult to see what problems you had as you didn't provide the responses you got from following the step by step
<FromGitter> <Daniel-Worrall> and instead posted the journey of what you tried and what eventually worked
<FromGitter> <simenge> let me see if i can find the logs, one sec
<FromGitter> <Daniel-Worrall> Great!
<FromGitter> <Val> `apt install dirmgr` to begin
<FromGitter> <simenge> that should be on that doc page
<FromGitter> <Val> after that `apt-key` command should work
<FromGitter> <simenge> damn, how to i copy from a windows terminal
<FromGitter> <simenge> if i want to get the log of all i did
<FromGitter> <Daniel-Worrall> Right click the top, select Mark
<FromGitter> <simenge> here is the complete log, right after i installed ubuntu/bash
<FromGitter> <simenge> it's very long
<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> <straight-shoota> The proper workaround for apt-key adv is using `curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=09617FD37CC06B54" | sudo apt-key `
<FromGitter> <simenge> Oh well, guess it's time for me to do my part and start porting crystal stuff to windows native
<FromGitter> <simenge> I did curl -sL "https://keybase.io/crystal/pgp_keys.asc" | sudo apt-key add
<FromGitter> <simenge> is there any downside to that?
<FromGitter> <straight-shoota> sorry, my bead
<FromGitter> <straight-shoota> bad
<FromGitter> <straight-shoota> yeah, keybase should be fine
<FromGitter> <straight-shoota> rystal-lang/crystal-book#259
<FromGitter> <straight-shoota> crystal-lang/crystal-book#259
wontruefree has joined #crystal-lang
duane has quit [Ping timeout: 264 seconds]
duane has joined #crystal-lang
<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)
ua has joined #crystal-lang
<crystal-gh> [crystal] felixbuenemann opened pull request #6381: Autodetect llvm-config-6.0 / llvm-config60 (master...llvm-config-6.0-support) https://git.io/fNqAY
<FromGitter> <drum445> PullParser ?
rohitpaulk has joined #crystal-lang
<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.
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/fNmJA
<crystal-gh> crystal/master 72eedae Felix BΓΌnemann: Autodetect llvm-config-6.0 / llvm-config60 (#6381)
<FromGitter> <drum445> cheers guys, is there a way to check if a var has the union type nil?
<FromGitter> <talbergs> how could I reason about watching a file for changes? Where to look in api docs?
<crystal-gh> [crystal] asterite opened pull request #6382: Bug/6018 macro if newline (master...bug/6018-macro-if-newline) https://git.io/fNmTs
wontruef_ has joined #crystal-lang
<FromGitter> <talbergs> nvm `File.info("foo").modification_time`
wontruefree has quit [Ping timeout: 244 seconds]
<FromGitter> <talbergs> .. and polling it. But may there be more elegant way (or the polling is the only one?)
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii has joined #crystal-lang
akaiiro has quit [Ping timeout: 244 seconds]
akaiiro has joined #crystal-lang
<FromGitter> <Blacksmoke16> prob store mod time in a var and use a loop to see if that variable changed every x seconds
<FromGitter> <bew> @talbergs you might want to checkout https://github.com/petoem/inotify.cr
Raimondii is now known as Raimondi
duane has quit [Ping timeout: 260 seconds]
<FromGitter> <talbergs> will the inotify c binding work on osx,linux,win?
<travis-ci> crystal-lang/crystal#72eedae (master - Autodetect llvm-config-6.0 / llvm-config60 (#6381)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/403732748
<DeBot> https://github.com/crystal-lang/crystal/pull/6381 (Autodetect llvm-config-6.0 / llvm-config60)
wontruef_ has quit [Quit: bye]
<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> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b491f36c02eb83d7c71a9ec]
<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
<FromGitter> <talbergs> many questions: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ most confusing thing is that many times "job" is printed twice on single `echo "a" >> conf.json` ... [https://gitter.im/crystal-lang/crystal?at=5b4930fe6534bc5d2e595641]
<FromGitter> <Blacksmoke16> yes
<FromGitter> <talbergs> any idea on `sleep 1.seconds` stopping all party?
<travis-ci> crystal-lang/crystal#e6d0be2 (master - Fix: named arguments expanded from double splat clash with local variable names (#6378)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/403762491
<DeBot> https://github.com/crystal-lang/crystal/pull/6378 (Fix: named arguments expanded from double splat clash with local variable names)
<FromGitter> <Blacksmoke16> prob has something to do with how fibers work, im not too sure
<crystal-gh> [crystal] RX14 closed pull request #6382: Fix: accept newline before closing macro (master...bug/6018-macro-if-newline) https://git.io/fNmTs
DTZUZO has quit [Ping timeout: 260 seconds]
<travis-ci> crystal-lang/crystal#7503211 (master - Fix: accept newline before closing macro (#6382)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/403772039
<DeBot> https://github.com/crystal-lang/crystal/pull/6382 (Fix: accept newline before closing macro)