ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.23.1 | Fund Crystal's development: | GH: | Docs: | API: | Gitter:
mbarbar has joined #crystal-lang
aroaminggeek[awa is now known as aroaminggeek
aroaminggeek is now known as aroaminggeek[awa
aroaminggeek[awa is now known as aroaminggeek
aroaminggeek is now known as aroaminggeek[awa
aroaminggeek[awa is now known as aroaminggeek
sotrhraven has joined #crystal-lang
aroaminggeek is now known as aroaminggeek[awa
aroaminggeek[awa is now known as aroaminggeek
aroaminggeek is now known as aroaminggeek[awa
p0p0pr37 has quit [Quit: Going offline, see ya! (]
<FromGitter> <simenge> Okay guys, I've cooled off. Last time things got heated, and I'll take a lot of the blame for that, although I feel some people were unnecessarily confrontational as well. Anyways, that's water under the bridge.
<FromGitter> <bew> That's good to hear, welcome back ;)
<FromGitter> <simenge> @RX14 I've rewritten my code and it's now much more idiomatic. I was able to remove most of the explicit casts, but not quite all.
<FromGitter> <simenge> Here is the new code: Most of it was written without looking at your rework, the one trick I picked up was the handy forward_missing_to macro
aroaminggeek[awa is now known as aroaminggeek
<FromGitter> <faustinoaq> @simenge Good to see you again πŸ˜„ ⏎ ⏎ I think this code: ⏎ ⏎ ``` def argcheck(fn : Builtin, args)``` ... []
<FromGitter> <bew> In `Env#[]` to remove the `.as` you can do: `elseif parent = @parent; parent[key]; ...`
<FromGitter> <bew> Instead of using `env.has_key? key` you should use `env[key]?` which will give you the value or nil
<FromGitter> <bew> This can simplify `Env#[]`, the first check by doing `if value = @env[key]?; value; elseif ...`
DTZUZO has quit [Quit: WeeChat 2.0]
rohitpaulk has joined #crystal-lang
kelv665 has joined #crystal-lang
kelv665 has quit [Remote host closed the connection]
<FromGitter> <mjago> @simenge πŸ‘ looking good
aroaminggeek has left #crystal-lang ["Textual IRC Client:"]
<FromGitter> <simenge> Thanks for the suggestions guys! Both worked! Except I can't use end[key]? because nil is actually an allowable value, just like in most lisps and ruby, every variable is nilable
rohitpaulk has quit [Ping timeout: 256 seconds]
ua_ has joined #crystal-lang
ua__ has quit [Ping timeout: 240 seconds]
ua__ has joined #crystal-lang
<FromGitter> <matrixbot> `vegai` Morning, fellow crystallites
ua_ has quit [Ping timeout: 248 seconds]
<FromGitter> <imonmyown> morning all :)
claudiuinberlin has joined #crystal-lang
ua_ has joined #crystal-lang
ua__ has quit [Ping timeout: 256 seconds]
alex`` has joined #crystal-lang
rohitpaulk has joined #crystal-lang
haken_gra355 has joined #crystal-lang
g-cl702 has joined #crystal-lang
g-cl702 has quit [Remote host closed the connection]
panter321 has joined #crystal-lang
panter321 has quit [Remote host closed the connection]
haken_gra355 has quit [Ping timeout: 260 seconds]
alex`` has quit [Quit: WeeChat 2.0]
RaPPeRB775 has joined #crystal-lang
RaPPeRB775 has quit [Remote host closed the connection]
riddi374 has joined #crystal-lang
riddi374 has quit [Remote host closed the connection]
<FromGitter> <bew> @simenge about nil, maybe you should have your own Nil type for your list interpreter, and keep the crystal nil reserved
<FromGitter> <bew> s/list/lisp
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
ashirase has quit [Ping timeout: 260 seconds]
ashirase has joined #crystal-lang
ua__ has joined #crystal-lang
ua_ has quit [Ping timeout: 248 seconds]
<FromGitter> <extremety1989> hey guys, have someone worked with D lang ?
<FromGitter> <simenge> @bew I'll consider it, but this way makes things a lot easier in many ways. This way, the result of eval is (almost always) a native Crystal type. I also took a look at another Crystal lisp implementation called Slang, and it, too, uses the native Nil type.
<FromGitter> <simenge> I prefer raising exceptions rather than having to do null checks, in the rare occasions this would be useful
<RX14> @simenge did you see my solution?
<RX14> I linked it earlier
<RX14> oh nvm i reread it
<RX14> yes you did
<FromGitter> <sdogruyol> does anyone have any idea why this crashed the compiler?
<RX14> @sdogruyol because we forgot a .at(loc) call in the compiler somewhere
<RX14> which means a certain ASTNode doesn't have a file:line number
<RX14> causing that LLVM error
<FromGitter> <sdogruyol> Ah lol
<RX14> basically it's our bug, report it
<FromGitter> <sdogruyol> I'll try with master if not I'll open an issue
<FromGitter> <sdogruyol> Thanks Chris
<FromGitter> <simenge> Yes, @RX14, I'm slowly starting to get why things work the way they work. I still have some different opinions on things, but I'll keep them to myself until I know the language better. Sorry for getting so worked up yesterday. Just needed to cool off
<FromGitter> <sdogruyol> hey @simenge, welcome to Crystal community πŸŽ‰
<RX14> @simenge the fault isn't all yours, I don't want to make you feel bad. Let's leave it in the past.
<FromGitter> <simenge> thanks
<FromGitter> <simenge> yes let's move on
<RX14> @simenge if you have your own opinions i'm always happy to try to explain why we chose another path
<RX14> I don't think I explained well enough why pattern matching works well in functional languages but turns out to not be neccesary in crystal
<FromGitter> <simenge> No, I really find complex destructuring in a type-safe way to be very useful
<Yxhuvud> like, I can see how pattern matching is nice in elixir for example, but I wouldn't know how to add it in a way that make sense and doesn't compete too much with other things in the language
<RX14> pattern matching really works a lot better with algebraitc data types
<RX14> i think C# implemented pattern matching though
<RX14> i should probably have a look at what they ddi with it
<FromGitter> <bararchy> wow, writing a crawler that should handle Wix sites is terrible
<FromGitter> <bararchy> it's like 99% parsing JS and 1% HTML
<RX14> thats because wix is terrible clearly
<FromGitter> <bararchy> It's seems to work XD
<FromGitter> <bararchy> as in, Wix seems to work
<FromGitter> <bararchy> so It can't be that bad
<Papierkorb> If you're implementing the browser in JS in the browser, it may "look to work", but it's still garbage
<FromGitter> <bararchy> true there
<FromGitter> <bararchy> @ysbaddaden did you manage to figure out how to staticly compile a crystal program which can handle Exception without sigfault?
ua__ has quit [Quit: Leaving]
<crystal-gh> [crystal] sdogruyol opened pull request #5395: Improve division by zero exception (master...master)
<FromGitter> <Jens0512> Can't you do: `some_char = '\u#{i}'`?
<FromGitter> <Jens0512> Or i mean, I'm getting an error (`expected hexadecimal character in unicode escape`), but is there a way to do this error?
<Papierkorb> No, you can't. Use `Int#chr` instead: my_char = 123.chr
<FromGitter> <Jens0512> Oh ok thank you very much
rohitpaulk has quit [Ping timeout: 240 seconds]
sotrhraven has quit [Quit: sotrhraven]
rohitpaulk has joined #crystal-lang
ua has joined #crystal-lang
<crystal-gh> [crystal] MakeNowJust opened pull request #5396: Parser: set location to empty exception handler correctly (master...fix/crystal-parse/set-location-to-empty-exception-handler)
<greenbigfrog> The emacs package is failing to format properly. Is it only me?
<oprypin> greenbigfrog, run crystal tool format manualy on it, see what it says
<Yxhuvud> I wonder what it is crystal-mode doesn't like in that code - there is nothing obvious
<greenbigfrog> crystal tool format works (btw., didn't mention)
<FromGitter> <faustinoaq> vscode-crystal-lang formatter works fine, maybe you can open an issue here πŸ‘‰
mbarbar has quit [Ping timeout: 256 seconds]
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter> <eliasjpr> QQ: When inheriting from a class how can we redeclare an instance variable?
<FromGitter> <eliasjpr> Im getting a `{var_name} is already declared as {some var declaration}`
<Papierkorb> You can't, as that'd would break the assumption the parent class makes about its environment
<FromGitter> <eliasjpr> So in this case it would be better to write a new class that shares 90% of another implementation?
<Papierkorb> There are plenty solutions. You can use a Module. Or a generic Class.
<Papierkorb> Or a generic module. Or maybe an abstract class which doesn't declare its ivars, but dunno if that'd actually work.
<FromGitter> <eliasjpr> Mmm module… that sounds like a solution
<greenbigfrog> how do I confirm that I'm actually using that package? I do not have that much experience with emacs.
rohitpaulk has joined #crystal-lang
<crystal-gh> [crystal] Sija opened pull request #5397: Add default argument to Number#round (master...number-round-default-arg)
rohitpaulk has quit [Ping timeout: 248 seconds]
<Yxhuvud> Hmm, is it just me or does crystal tool expand index columns with a 1-based instead of a 0-based index?
<Papierkorb> Could be, text editors also use 1-based indices when showing it to the user
<Papierkorb> Aren't columns and rows commonly 1-indexed?
<Yxhuvud> I may have been confused by emacs indexing cursors at the first position as 0. I guess tool expand cares about what is in the middle and not the endpoints so I guess it makes sense.
<RX14> i think pretty much everything indexes lines from 1 and columns from 0
<Papierkorb> atom 1-indexes both
<Papierkorb> And kate does too
<RX14> huh
MiniMe333 has joined #crystal-lang
MiniMe333 has quit [Client Quit]
<Yxhuvud> oh well *increments argument*.
<FromGitter> <Jens0512> Im sorry, but i will have to ask a noob question as i can't figure it out (and i won't bother you for a while after that): can i somehow make a `class MyNumber` and do something like this with it: ``` ⏎ my_nymber = 10 ⏎ puts my_number #=> 10 ⏎ ⏎ `````` []
<Papierkorb> Jens0512, override Object#to_s in your class:
<Papierkorb> Maybe Object#inspect(io) too
<FromGitter> <Jens0512> Please \*begs\* i love the lang, but as a java programmer, I'm having some trouble with learning it
<FromGitter> <Jens0512> Oh
<FromGitter> <Jens0512> Thanks :D
<FromGitter> <Jens0512> Then i can just overload + and so also! Haha, i have every reason to love this language! ^^
<FromGitter> <picatz> @Jens0512 This language is fantastic, I agree! :D
<FromGitter> <picatz> Like any language, it has a learning curve. But, it's been well worth trying to hurdle over those challenges. πŸ‘ ✨
<Yxhuvud> I don't think you are overloading anything unless the class already defines a +.
<FromGitter> <Jens0512> Oh, yeah, haha, this concept of overloading just gets me so exited as you can't do anything like that with +/= or whatever there
<Papierkorb> As Javaraner you'll probably enjoy the modern OOP touches Crystal offers over Java
<FromGitter> <Jens0512> I will for sure
<Yxhuvud> modern OOP? Hasn't crystal it mostly from ruby which has it from smalltalk which is .. older? java otoh has concepts like interfaces etc which doesn't exist here. What features are you thinking of?
<Yxhuvud> the big departing from smalltalk is the lack of send and dynamic dispatch, but java also typically doesn't do that, right? (even though I think it may be possible through some introspection)
<FromGitter> <Jens0512> Does crystal have multiple inheritance?
<Yxhuvud> Well, we have modules that can be included in a class.
<FromGitter> <Jens0512> I think i will have to play around with the lang some more before i can discuss these things anyways
Yxhuvud has quit [Read error: Connection reset by peer]
Yxhuvud has joined #crystal-lang
<Papierkorb> Yxhuvud: We have interfaces in the Java sense
<Yxhuvud> hmm?
<Papierkorb> Jens0512, no multiple inheritance
<FromGitter> <Jens0512> Ok, thanks
<Papierkorb> Yxhuvud: modules with abstract methods
<Yxhuvud> Hmm, ah yes.
<Yxhuvud> usage is mostly different though due to duck typing.
<Papierkorb> You can restrict that away
<Papierkorb> Traits would be a nice addition though
rohitpaulk has joined #crystal-lang
<FromGitter> <bew> Papierkorb I thought modules are like traits, what's the difference?
rohitpaulk has quit [Ping timeout: 240 seconds]
sz0 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
DTZUZU has quit [Quit: WeeChat 1.9]
sz0 has quit [Quit: Connection closed for inactivity]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
akd79 has joined #crystal-lang
<akd79> β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„ DID YOU GUYS KNOW TODAY WAS NIGGERS DAY?? SAY HI TO YOUR FAVORITY NIGGER IN #FREENODE!! quicktalkeh676te.onionezlpnkml: SuperChickeNES lvmbdv mroth jfontan davic DeBot_ gewo mjblack andersh txdv cyberarm z64 raz avdi hmans claudiuinberlin Yxhuvud nathanj handicraftsman _whitelogg
<akd79> β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„ DID YOU GUYS KNOW TODAY WAS NIGGERS DAY?? SAY HI TO YOUR FAVORITY NIGGER IN #FREENODE!! quicktalkeh676te.onionebszbwnt: Yxhuvud [spoiler] sevensidedmarble davic foxxx0 tatey ephemera_ shelvacu raz lvmbdv cyberarm Majost tilpner jhass salvor bmcginty foca _whitelogger woodruffw olba mroth aemadrid fiete ua asterite andersh foxbot
akd79 has quit [Remote host closed the connection]
<claudiuinberlin> wtf is this shit
<ua> gay band so secret they have hide behind tor
<RX14> the problem is they disappear so quickly there's no point banning them
<Papierkorb> Well #freenode doesn't like that either. They advised to wait it out (until they figured out how to stop it?), or to only allow identified users. Meh.
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
claudiuinberlin has quit [Quit: Textual IRC Client:]
astronavt has joined #crystal-lang
<crystal-gh> [crystal] larubujo opened pull request #5398: pointerof lib external (master...pointer-lib-external)
oprypin has quit [Quit: Bye]
oprypin has joined #crystal-lang