jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
deavmi has quit [Ping timeout: 240 seconds]
deavmi has joined #crystal-lang
kevinsjoberg has quit [Ping timeout: 240 seconds]
kevinsjoberg has joined #crystal-lang
rocx has quit [Ping timeout: 244 seconds]
<FromGitter> <perfecto25> hello, quick question, is there a way to get an IP address a network interface? ⏎ ie, ⏎ ⏎ ```get_IP("eth1") ⏎ ⏎ # returns 192.168.40.34 ⏎ ``` ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5f1f84c2d50f2b289a9d0058]
<FromGitter> <Blacksmoke16> mm not sure something like that exists atm
<FromGitter> <mixflame> open a connection and then check socket.local_address
<FromGitter> <mixflame> is my guess
<FromGitter> <mixflame> might not work for your usecase
<FromGitter> <mixflame> maybe you can achieve the function by running system commands
<FromGitter> <mixflame> I think you can drop to C, include this or port this https://stackoverflow.com/questions/2283494/get-ip-address-of-an-interface-on-linux
<FromGitter> <perfecto25> cool will try c binding thx
<FromGitter> <mixflame> np
f1refly has joined #crystal-lang
f1reflyylmao has quit [Ping timeout: 240 seconds]
<FromGitter> <dscottboggs_gitlab> problem is that won't be cross-platform. A library should exist for this that does this for any operating system
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
lanodan has quit [Quit: WeeChat 2.8]
oddp has joined #crystal-lang
HumanG33k has quit [Ping timeout: 256 seconds]
HumanG33k has joined #crystal-lang
yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
yxhuvud has joined #crystal-lang
lanodan has joined #crystal-lang
<FromGitter> <anapsix> there is that https://github.com/arcage/net_sample.cr
Rounin has joined #crystal-lang
oddp has quit [Quit: quit]
<FromGitter> <sirikon> Is it possible that an `Error writing to socket: Broken pipe (IO::Error)` affects other IO pipes?
<yxhuvud> uh, it shouldn't. But it is not impossible that the same reason one socket dies is the reason another die. Think network disconnect or similar.
<FromGitter> <sirikon> My issue currently is: ⏎ ⏎ I have a process running, with stdout connected to a IO.pipe() writer. ⏎ Then I have an open http request, sending the bytes to the client as they come from stdout (each byte is written and flushed to the http response). [https://gitter.im/crystal-lang/crystal?at=5f201472d7efe5438f27e98b]
<FromGitter> <sirikon> It works fine. But if the http connection closes (because I reload the web page, for example, and the XHR request gets cancelled): ⏎ ⏎ 1) - I can't detect that the response already closed, so flushing it raises an exception ⏎ 2) - Even If i rescue that exception, the IO that reads the process stdout just stops receiving bytes [https://gitter.im/crystal-lang/crystal?at=5f2014cce90668200521d225]
<FromGitter> <sirikon> And there aren't any other exceptions being raised, at least not shown in terminal (there isn't any `rescue`, just the one in the request handler that rescues if `response.flush` fails)
<FromGitter> <sirikon> Ok... I think I fixed it but not sure why. Moved everything IO-related initialization or reading to a new `spawn` block and it doesn't happen anymore.
oddp has joined #crystal-lang
oddp has quit [Client Quit]
<FromGitter> <sirikon> Ok, I didn't realize that during the process' stdout IO consumption and `response.flush`, everything was on the same fiber. `spawn`ing a new fiber for `response.flush` prevents failures
<FromGitter> <sirikon> It's weird, still, because even if the exception gets rescued, it ends up affecting other IO on the same fiber?
<FromGitter> <Blacksmoke16> @jwaldrip as a heads up https://github.com/jwaldrip/admiral.cr#sub-commands doesn't compile
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f201ef23eef7e1ffe3c415b]
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f201ef9cd7bed0e37979a4a]
<FromGitter> <Blacksmoke16> also it should have `Hello.run`
<FromGitter> <perfecto25> @anapsix this is perfect thank you
<FromGitter> <sirikon> Is it possible to iterate over files in a directory in a macro?
<FromGitter> <anapsix> macro can execute a system command, so there's at least that
<FromGitter> <Blacksmoke16> pretty sure it would return a string literal tho
<FromGitter> <Blacksmoke16> so it might work if you split on like `\n`?
<FromGitter> <anapsix> but, would it execute at compile time?
<FromGitter> <sirikon> Yea, could run `find ...` and then split
<FromGitter> <sirikon> but wanted to avoid running system commands, as much as possible
<FromGitter> <anapsix> would it be possible make a code block within macro, then call it?
<FromGitter> <sirikon> I didn't understand your question @anapsix
<FromGitter> <Blacksmoke16> whats your use case for wanting to do this @sirikon ?
<FromGitter> <sirikon> I have a `templates` folder. Don't want to repeat the same block for each file in it.
<FromGitter> <sirikon> I'm using `ECR`
<FromGitter> <Blacksmoke16> got a code example?
<FromGitter> <sirikon> I had something like ⏎ ⏎ ```def home(data) ⏎ render "home" ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5f2038cb25cae90e6d8812e1]
Human_G33k has joined #crystal-lang
<FromGitter> <sirikon> Got a kinda-hacky and working solution: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f203cc777eccd0e147e6658]
<FromGitter> <sirikon> Not sure if proud of it 😂
HumanG33k has quit [Ping timeout: 240 seconds]
mistergibson has joined #crystal-lang
<FromGitter> <anapsix> 🤩
<FromGitter> <sirikon> It would be way cleaner if each template file could define it's own function, but looks like the first thing in the generated code is always `io << ""`, even if the function starts with `<%- whatever -%>`, so, can't put it outside of a class in that way
<FromGitter> <Blacksmoke16> imo i dont see the problem with what you had before with the `render` method and just having a method for each
<FromGitter> <sirikon> That doesn't scale well when layouts are involved, too much copy-paste for me
<FromGitter> <sirikon> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f203f5cbc41f368172decef]
<FromGitter> <sirikon> I use functions with `yield` as base templates
<FromGitter> <sirikon> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f203f7bfe6ecd28887c7718]
v2px__ has joined #crystal-lang
<FromGitter> <sirikon> > but looks like the first thing in the generated code is always io << "", even if the function starts with <%- whatever -%> ⏎ ⏎ Okat that's WRONG, I had a mistake when gave it a try. Now can simplify the macro a lot. ⏎ ⏎ If i'm too spammy just say it people [https://gitter.im/crystal-lang/crystal?at=5f204208d7efe5438f28748a]
<FromGitter> <Blacksmoke16> wouldnt it be easier to look into one of the other templating engines
<FromGitter> <Blacksmoke16> that support this kind of stuff
<FromGitter> <sirikon> Better a little code than a little dependency :D
<FromGitter> <Blacksmoke16> i mean does it really matter
<FromGitter> <sirikon> I prefer to have a little piece of code that does something, instead of involving a whole new package, with it's own release cycles and every detail involved ⏎ ⏎ The extreme opposite of "better a little code than a little dependency" is the `left-pad` issue in the Node community.
<FromGitter> <Blacksmoke16> yea but this isnt a little code
<FromGitter> <Blacksmoke16> you make a layout with blocks, then define the content of each block
<FromGitter> <Blacksmoke16> https://github.com/straight-shoota/crinja#file-loader also kinda solves your `templates/` dir issue
<FromGitter> <sirikon> ```code paste, see link``` ⏎ ⏎ The complete solution (minus the templates themselves) is solved with 24 LoC. Crinja is pretty cool, but don't need it. [https://gitter.im/crystal-lang/crystal?at=5f20438ab1409c060f8c8ad0]
<FromGitter> <sirikon> Also Crinja introduces probably too much complexity for my needs
<FromGitter> <Blacksmoke16> as you wish
<FromGitter> <sirikon> Thanks anyway for the suggestion :)
<FromGitter> <Blacksmoke16> `work` eh, this doesnt happen to be that thing @vladfaust was working on ages ago would it? :p
<FromGitter> <sirikon> Can negotiate a new name 😂
<FromGitter> <Blacksmoke16> nvm, its spelled diff
<FromGitter> <Blacksmoke16> `worcr`
<FromGitter> <Blacksmoke16> and dead anyway so it doesnt matter
<FromGitter> <sirikon> No probs then 💃
<FromGitter> <jwoertink> I just installed https://starship.rs/ and it has built-in crystal detection by default 😂
<FromGitter> <jwoertink> https://starship.rs/config/#crystal
<FromGitter> <ImAHopelessDev_gitlab> one line ifs are so nice
v2px__ is now known as zorp
<FromGitter> <dscottboggs_gitlab> @ImAHopelessDev_gitlab so true
<FromGitter> <dscottboggs_gitlab> although I wish we had one line `if ... then ... else` instead of that ugly c-style ternary operator
<FromGitter> <j8r> @dscottboggs_gitlab or like python `somethig if some_cond else do_that`?
<FromGitter> <dscottboggs_gitlab> yeah, that would be better than `:?` but it always felt awkward to read those to me
<FromGitter> <sardaukar> hello!
<FromGitter> <sardaukar> right now, I exit from my command line utility if a `TEST` env var is set to run my specs - is there an established best practice around this?
<FromGitter> <sardaukar> (so that I don't get a command line usage error, exit and therefore abort the specs)
<FromGitter> <dscottboggs_gitlab> The encouraged pattern for this is to have your CLI in a separate file, and not include that file in the specs.
<FromGitter> <dscottboggs_gitlab> See this forum post (https://forum.crystal-lang.org/t/is-there-any-equivalent-to-cs-main-or-pythons-if-main-statement/450) I made a while back
<FromGitter> <sardaukar> thanks, will have a look
<FromGitter> <wontruefree> I really enjoyed talking with Jeremy Woertink about the Lucky framework and running Crystal in production. ⏎ http://podcast.chicagocrystal.org/1030945/4753796-jeremy-woertink-runing-not-walking-with-crystal
<FromGitter> <ImAHopelessDev_gitlab> http://podcast.chicagocrystal.org/1030945/4753796-jeremy-woertink-runing-not-walking-with-crystal rofl the link to jeremy's profile goes to blacksmoke's
<FromGitter> <ImAHopelessDev_gitlab> @Blacksmoke16 nice interview! :D
<FromGitter> <bararchy> Is there a helper to test if Int is between Int and Int ?
<FromGitter> <wontruefree> weird I "unlinked" it and it seems to work now
<FromGitter> <wontruefree> thanks @ImAHopelessDev_gitlab
<FromGitter> <wontruefree> managing content is a lot of work but I appreciate the help
ryanprior has quit [Ping timeout: 244 seconds]
ryanprior has joined #crystal-lang
<FromGitter> <ImAHopelessDev_gitlab> nice podcast
<FromGitter> <ImAHopelessDev_gitlab> still listening
<FromGitter> <asterite> @bararchy 1 <= x <= 10
<FromGitter> <ImAHopelessDev_gitlab> @dscottboggs_gitlab u don't like the old c style ternary?
<FromGitter> <dscottboggs_gitlab> no it's not very clear or readable, especially next to the rest of Crystal's elegance
<FromGitter> <dscottboggs_gitlab> sure once you know what it means it's fine but you shouldn't have to figure that sort of thing out when you could just use words and be self-expressive, you know?
<raz> i'm torn on them. i love to write them but hate to read them
<FromGitter> <dscottboggs_gitlab> that's a fair point
<FromGitter> <dscottboggs_gitlab> I like to have editor features for ease of writing and language features for ease of reading though. That's a personal preference though, I know some people prefer a more plain text editor
<raz> yup. they can improve readability for simple cases
<FromGitter> <wontruefree> thanks @ImAHopelessDev_gitlab ! I had fun recording it
<raz> but unfortunately the cases often don't stay simple
<raz> once you have a nested method call on both sides of the : it's usually better to split it out over multiple lines
<FromGitter> <ImAHopelessDev_gitlab> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f2086f3d7efe5438f293df7]
<FromGitter> <bararchy> @asterite I was sure there was some Int32.in_between(1, 10) sugar syntax
<oprypin> bararchy, no idea why you ping asterite
<oprypin> the function is "clamp"
<FromGitter> <dscottboggs_gitlab> asterite had replied to him earlier
<FromGitter> <bararchy> oprypin, because he answered ,me above? ;)
<FromGitter> <dscottboggs_gitlab> always forget about clamp
<FromGitter> <ImAHopelessDev_gitlab> i love clamp
<FromGitter> <bararchy> thanks though! yeha, that was the one 😁
<oprypin> oh ok sorry. the Ctrl+F failed me by not actually searching within names
<FromGitter> <bararchy> no worries :)
<FromGitter> <ImAHopelessDev_gitlab> i use upto, and downto to extract connected links from items in gear. crystal has the best gamedev methods
<FromGitter> <bararchy> @ImAHopelessDev_gitlab still waiting for the beta invite ;)
<FromGitter> <bararchy> only for 5 years now, I'll keep waiting though
<FromGitter> <ImAHopelessDev_gitlab> no worries, i'll shoot you a pm on gitter when its ready
<FromGitter> <Blacksmoke16> what about it?
<FromGitter> <dorianmariefr> on https://crystal-lang.org/reference/guides/performance.html it says that memory has increased but in the benchmark result it looks like it decreased
<FromGitter> <dorianmariefr> or is that number of million of runs maybe... that would make more sense
<FromGitter> <Blacksmoke16> yes, idt that output has the memory,sec
<FromGitter> <Blacksmoke16> I think its using an older output of the benchmark stuff w/o memory usage, this is the latest output
<FromGitter> <dorianmariefr> yeah, nevermind, i realized too late i was mistaken (but i will be coming back with more questions soon :D )
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f209333cd7bed0e37990ae1]
<FromGitter> <Blacksmoke16> a PR could prob be made to update that...
<FromGitter> <Blacksmoke16> and the other benchmark outputs
<FromGitter> <dorianmariefr> and https://crystal-lang.org/reference/getting_started/ could be updated to the latest version too
<FromGitter> <dorianmariefr> $ crystal --version ⏎ Crystal 0.34.0 (2020-04-07)
<FromGitter> <Blacksmoke16> eh, would be kinda painful to do every release, esp given the docs say "something like"
<FromGitter> <dorianmariefr> BTW I'm following a book and I would like to write "doubly-linked list of heap-allocated strings." in Crystal, any pointers (haha) of how I could do that?
<FromGitter> <Blacksmoke16> aka a tuple?
<FromGitter> <Blacksmoke16> or array
<FromGitter> <Blacksmoke16> `["foo", "bar", "baz"]`?
<FromGitter> <dorianmariefr> yeah that's what i was thinking, in C you have to implement it yourself but in Crystal it's already implemented with an array, thanks
<FromGitter> <Blacksmoke16> arrays are the heap, if its immutable/static look into a https://crystal-lang.org/api/master/Tuple.html
<FromGitter> <Blacksmoke16> are on the*
alexherbo2 has joined #crystal-lang
<FromGitter> <dorianmariefr> a little issue i have with crystal is i keep going to some old documentation when searching something on google, maybe the documentation could always link to the last one (like apidock does for rails)?
<FromGitter> <Blacksmoke16> best option is to just keep a tab open with the latest
<FromGitter> <dscottboggs_gitlab> yes, there is `/api/latest`, but search results are often pinned to a specific out-dated version
<FromGitter> <Blacksmoke16> there are some issues related to that, not sure the current state of things tho
<FromGitter> <dscottboggs_gitlab> I just have the reference bookmarked
<FromGitter> <Blacksmoke16> i just use `/api/master` and all it a ay
<FromGitter> <Blacksmoke16> a day*
<FromGitter> <dorianmariefr> i just so used to googling things, nobody beats google for search :)
<FromGitter> <Blacksmoke16> there is the version dropdown now, prob still some improvements that an be made for sure
<FromGitter> <dorianmariefr> trying to write a spec for my pull request, I got: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ any idea what this means? [https://gitter.im/crystal-lang/crystal?at=5f209d7e77eccd0e147f8f4b]
<FromGitter> <Blacksmoke16> that method doesnt exist for the module you defined
<FromGitter> <Blacksmoke16> how did you run the specs?
<FromGitter> <dorianmariefr> the thing is i didn't change that part, I just added a new spec that is quite simple and doesn't use pending_win32. i did `crystal spec spec/compiler/crystal/tools/init_spec.cr`
<FromGitter> <Blacksmoke16> `./bin/crystal spec spec/compiler/crystal/tools/init_spec.cr` try that
<FromGitter> <dorianmariefr> same error with `./bin/crystal` and with `.build/crystal` i get ⏎ ⏎ ```error in line 1 ⏎ Error: can't find file 'prelude'``` [https://gitter.im/crystal-lang/crystal?at=5f209e25fe6ecd28887da101]
<FromGitter> <Blacksmoke16> got a diff of what you added?
<FromGitter> <Blacksmoke16> also i assume you built it with like `make clean && make`?
<FromGitter> <dorianmariefr> okay, i'm rebuilding crystal
<FromGitter> <Blacksmoke16> hmm
<FromGitter> <dorianmariefr> oh, I added `require "../../../support/win32"` and it looks better now, not sure where it's called though
<FromGitter> <dorianmariefr> also i get `Program received and didn't handle signal TRAP (5)` when i put `debugger` in the code, i have gdb and lldb installed so it should work, the documentation seems to be for visual code studio but i use vim
<FromGitter> <dscottboggs_gitlab> when debugging you have to compile the app then run it with a debugger like `gdb path/to/exe -- arg1 arg2`
<FromGitter> <dorianmariefr> hmm i thought gdb would be simpler, i read a cheat sheet and doesn't have anything working :D anyway, puts debugging to the rescue :D my test correctly fails now but i can't run it with the fixed version of crystal, i will push that to the build server :D
<FromGitter> <dorianmariefr> so if anybody has an idea about the prelude error that would be nice, i just used `make` to compile the compiler and then it's in `.build/crystal` but i get:
<FromGitter> <dorianmariefr> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f20a2a5cd7bed0e3799357d]
<oprypin> dorianmariefr, u cant use .build/crystal
<oprypin> if u want u have to replicate environment variables that bin/crystal sets
<oprypin> importantly, CRYSTAL_PATH
<FromGitter> <dorianmariefr> oh okay, i see, bin/crystal actually uses .build/crystal so that's the correct way to do it (my spec is still not passing :D)
<FromGitter> <watzon> @Blacksmoke16 idk if the docs are out of date or what, but this doesn't seem to work
<FromGitter> <watzon> The `foreign_key: uuid : String` part
<FromGitter> <watzon> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f20a70db1409c060f8dac94]
<FromGitter> <Blacksmoke16> mm
<FromGitter> <Blacksmoke16> sec
<FromGitter> <Blacksmoke16> can you share what your model actually looks like?
<FromGitter> <watzon> Running version 0.21.1
<FromGitter> <watzon> Sure
<FromGitter> <watzon> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f20a762cd7bed0e379941b2]
<FromGitter> <Blacksmoke16> should that actually be `id : String`?
<FromGitter> <Blacksmoke16> because im pretty sure that would try to define another `id` column
<FromGitter> <watzon> Just realized I fucked up haha
<FromGitter> <watzon> It should be `scooter_id`
<FromGitter> <Blacksmoke16> that would do it
<FromGitter> <watzon> Is it intended that using the `create!` method doesn't work when passing in models? For instance, I can't do `Models::ScooterAlert.create!(user: user, scooter: scooter, alert_type: "alert")` it has to be `Models::ScooterAlert.create!(user_id: user.id, scooter_id: scooter.id, alert_type: "alert")`
zorp has quit [Ping timeout: 264 seconds]
<FromGitter> <Blacksmoke16> im not sure, prob not?
<FromGitter> <Blacksmoke16> what happens if you do like
<FromGitter> <watzon> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f20a878b1409c060f8daf9e]
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f20a886a050df4300206d83]
<FromGitter> <watzon> That works fine
<FromGitter> <watzon> Just doesn't work with the `create!` method
<FromGitter> <Blacksmoke16> this is part of the thing i dont like about granite, see https://github.com/amberframework/granite/pull/370
<FromGitter> <Blacksmoke16> i dont like all these implicit constructors
<FromGitter> <Blacksmoke16> IMO an ORM shouldn't be responsible for parsing values out of some random hash to create a model instance, just define an initializer like you would any other object
<FromGitter> <watzon> I think that would be perfectly acceptable
<FromGitter> <Blacksmoke16> mhm
<FromGitter> <watzon> I like the idea of replacing the `column` macro with annotations too
<FromGitter> <Blacksmoke16> to be clear `column` is just a warpper around that
<FromGitter> <Blacksmoke16> wrapper
<FromGitter> <Blacksmoke16> defines your ivar, applies the annotation, and defines some constructors
<FromGitter> <Blacksmoke16> er getter/setter
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
<FromGitter> <Blacksmoke16> making any progress on your orm? :p
<FromGitter> <watzon> Nah haha. I haven't been doing a ton of Crystal lately. Been searching pretty hard for a job.
<FromGitter> <watzon> Might have something next week
<FromGitter> <Blacksmoke16> ah, gl
<FromGitter> <dscottboggs_gitlab> shit you're looking for a job? You're so much better than me I'm so screwed... :(
<FromGitter> <watzon> Lol I've been looking for a while
<FromGitter> <watzon> Got a baby on the way now, so it's urgent
<FromGitter> <dscottboggs_gitlab> oh jeeze dude. best of luck to you ❤️
<FromGitter> <watzon> Thanks!
<FromGitter> <Blacksmoke16> if you're near Pittsburgh we're looking for another engineer
<FromGitter> <dscottboggs_gitlab> holy shit, @Blacksmoke16 you're near PGH?
<FromGitter> <Blacksmoke16> yes
<FromGitter> <dscottboggs_gitlab> that's crazy we've been chatting for years on here and I had no idea
<oprypin> so im dealing with a library that wants everything in °degrees, but crystal's Math wants everything in radians. what would you suggest to make this less annoying? insisting on radians isn't going great for me btw
<FromGitter> <Blacksmoke16> you from around there as well?
<FromGitter> <dscottboggs_gitlab> yeah I live in avalon
Human_G33k has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> `Degrees` type and have overloads that internally converts to radians and back to degrees?
<FromGitter> <Blacksmoke16> ah nice :p
Human_G33k has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> that sounds frustrating, oprypin
<FromGitter> <dscottboggs_gitlab> I'm sure it's not too hard to convert between deg and rad so you could just define a `#to_rad` on `Float`
<FromGitter> <Blacksmoke16> or a method that converts to radians? :shrug:
<oprypin> that method is of course what i have
<oprypin> the library has storage with getters & setters in degrees
<FromGitter> <dscottboggs_gitlab> @Blacksmoke16 who's the "we" who's looking for an engineer? I thought you did PHP professionally
<FromGitter> <Blacksmoke16> we meaning the company i work for yea
<FromGitter> <dscottboggs_gitlab> damn I don't know PHP for shit
<FromGitter> <Blacksmoke16> to be fair i didnt either when i started :S
<FromGitter> <Blacksmoke16> was more familiar with ruby at that point
<FromGitter> <Blacksmoke16> oprypin: i dont suppose you could extend `Float` or something along those lines?
<oprypin> O_o
<FromGitter> <Blacksmoke16> leaning to the right on hackiness scale tho imo
<FromGitter> <watzon> Yeah no where near Pittsburgh for me. I'm all the way in the Salt Lake Valley, Utah
Human_G33k has quit [Ping timeout: 240 seconds]
<FromGitter> <dscottboggs_gitlab> oof I visited SLC one time and I couldn't breathe. atmosphere is weird there
<FromGitter> <chasestory> I live there as well.. definitely heavier here..
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/9gsl something like that oprypin?
<FromGitter> <chasestory> went to Colorado last week, and it was like a weight was off my chest!
<oprypin> uhhh
<FromGitter> <Blacksmoke16> well, i mean its not much better than just doing `to_radians` :shrug:
<FromGitter> <dscottboggs_gitlab> yeah I feel like just defining `Float#to_radians` which returns another `Float` is good enough
<FromGitter> <dscottboggs_gitlab> but a lot of languages wouldn't allow that because of reopening float. ⏎ ⏎ UFCS FTW
<oprypin> i think ima `def sin(x); Math.sin(x * Math::PI / 180); end`
<FromGitter> <dscottboggs_gitlab> works
<FromGitter> <dscottboggs_gitlab> although a bit...obscured
<FromGitter> <dscottboggs_gitlab> idk `sin` doesn't just take the sin of x, it converts it to radians
<FromGitter> <watzon> @chasestory you're in Salt Lake?
<oprypin> dscottboggs_gitlab, well no it takes sin of x in degrees
<FromGitter> <watzon> Yeah the air quality here isn't great
<FromGitter> <dscottboggs_gitlab> oprypin, I see now, it doesn't matter 👍
<Rounin> Say, oprypin... Are you running that FromGitter bot? Am I the only one who felt like having nick coloring on there?
<oprypin> hmm now that i went through my code looking for closeted angle values i do believe i should mark them as such somehow... but how
<Rounin> (I have a script that does that in my client, though, which also colours XML for me and makes it all nice)
<oprypin> Rounin, i definitely dont want shitty nick coloring
<Rounin> oprypin: How about wonderful nick coloring?
<oprypin> DIY
<Rounin> Yes, this is what I do
<oprypin> Rounin, compare https://imgur.com/a/uKFEfd7
<Rounin> oprypin: Hehe, well, 1) I don't use Github, and 2) IRC only has a set number of colour codes, after all, so you don't get nice pastels or anything
<Rounin> I'll just keep it on in my own client
<oprypin> Rounin, git clone https://github.com/oprypin/critter.wiki and send me a patch via pastebin
<FromGitter> <plainas> ok, basic question, I am looking at the docs for modules but getting a bit confused....
<FromGitter> <watzon> What are you confused about?
<FromGitter> <plainas> ```module A ⏎ def b ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5f20ba5a77eccd0e147fd2c0]
<FromGitter> <watzon> should be ⏎ ⏎ ```def b ⏎ end``` ⏎ ⏎ but yes? [https://gitter.im/crystal-lang/crystal?at=5f20ba75f8dfed4382c5e789]
<FromGitter> <plainas> I accidentally had press enter before finished...
<FromGitter> <plainas> why doesn't b resolve?
<oprypin> in which situation
<FromGitter> <watzon> Modules can't be instantiated, and `def b` crates an instance method. If you want to be able to call `b` you have to include the module in a class
<FromGitter> <watzon> Otherwise you need `def self.b`
<Rounin> But now I have to sleep, whether you like it or not :D
<Rounin> I sort of pretend tested it with a tiny script
<Rounin> It was fun to program a bit after a few weeks off, though
<oprypin> Rounin, what thats not the patch i had in mind D:
<oprypin> i did mean clone the *wiki*
<oprypin> i will not enable colors regardless of the patch
<Rounin> Ah... Why would I clone the wiki again?
<oprypin> i mean if u have some nice way to make nickname integration work in your irc client, just share it
<oprypin> clone so you can create a patch so i submit to wiki with attribution :D
<FromGitter> <plainas> @watzon I see, thank you
<FromGitter> <watzon> The main purpose for modules is to act as a namespace or a mixin