ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | 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
postmodern has quit [Remote host closed the connection]
postmodern has joined #crystal-lang
<FromGitter> <baiorett> hi, quick question: how do i split crystal classes to multiple files
ur5us has quit [Ping timeout: 240 seconds]
<FromGitter> <Blacksmoke16> for what reason?
<FromGitter> <Daniel-Worrall> Just define them in multiple files.
<FromGitter> <Daniel-Worrall> You can reopen classes
<FromGitter> <Blacksmoke16> but to answer you're question just declare the class and add more stuff to ^
<FromGitter> <Blacksmoke16> re-declare
<FromGitter> <Daniel-Worrall> If you're overwriting methods in the same class, require order matters
<FromGitter> <baiorett> alright thank you
<FromGitter> <Blacksmoke16> i'd suggest thinking if you really want to do that tho. could just make things more confusing
<FromGitter> <baiorett> im sorta used to splitting classes because i came to crystal from java
ur5us has joined #crystal-lang
<FromGitter> <Blacksmoke16> Other people might not be. Especially if it's a small type
<FromGitter> <Blacksmoke16> Depends on the exact use case tho. Not going to really harm anything, but is possible it might mess with overload order
<FromGitter> <baiorett> > Depends on the exact use case tho. ⏎ i don’t think i’m really going to split each class and make tons of class-files
<postmodern> how do i link to constants in crystal docs?
<postmodern> also references to class-methods don't seem to be auto-linking.
<FromGitter> <Blacksmoke16> @baiorett good :P
<FromGitter> <Blacksmoke16> surround the const in back ticks
<FromGitter> <Blacksmoke16> are you using a `.` instead of `#`?
<postmodern> oh derp. kind of weird to overload markdown syntax like that, but ok
<postmodern> so `.foo` and `#foo` should link to the appropriate methods? `foo` won't, correct?
<FromGitter> <Blacksmoke16> it might if its in the same scope/file
<postmodern> er yeah, found the example in the reference
<postmodern> where is the repo for the `crystal doc` command? i noticed it doesn't add a `#` link next to constants, to allow permalinking to them.
<FromGitter> <Blacksmoke16> It's in crystal codebase
<FromGitter> <Blacksmoke16> Can link to constants section but not a specific one ATM
<postmodern> does crystal docs markdown parser understand tables?
<FromGitter> <Blacksmoke16> I would highly doubt it
<FromGitter> <Blacksmoke16> But you can try
<FromGitter> <Blacksmoke16> option b would be using mkdocs crystal extensino
<FromGitter> <Blacksmoke16> https://mkdocstrings.github.io/crystal/
dostoyevsky2 has quit [Quit: leaving]
dostoyevsky2 has joined #crystal-lang
dostoyevsky2 has quit [Client Quit]
dostoyevsky2 has joined #crystal-lang
<dostoyevsky2> I use a docker container these days as my dev environment... is there a way I could compile a crystal program for osx from linux/inside a docker container?
<FromGitter> <Blacksmoke16> mac doesn't support static binaries so that might be a bit tricky, however assuming its the same arch and the mac has the libraries installed it should work fine
<FromGitter> <Blacksmoke16> libraries like ones crystal runtime depends on, i.e. the dynamically linked ones
<FromGitter> <Blacksmoke16> would be easier to just build on the mac
ur5us has quit [Remote host closed the connection]
ur5us has joined #crystal-lang
<postmodern> so crystal prefers grammatically correct method names, like `includes?`. What are people's opinions on "indices" vs "indexes"?
<riza> do what you think is rightd
<riza> a classing example in the rails world is "medium" is the proper singular of "media" but nobody knows that
ur5us has quit [Ping timeout: 252 seconds]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 246 seconds]
ur5us has joined #crystal-lang
<postmodern> do people using write tests for `delegate`ed methods?
<postmodern> does `crystal doc` not support inline html, like <code> ?
ur5us has quit [Ping timeout: 272 seconds]
<FromGitter> <oprypin:matrix.org> postmodern, yeah it probably doesn't, (assuming you tried it?) https://github.com/mkdocstrings/crystal supports it, though. what's your use case?
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 252 seconds]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 258 seconds]
<postmodern> oprypin, just trying to format a README so that `crystal doc` renders the proper html
<postmodern> oprypin, unfortunately all of the markdown parsers (github, ruby's kramdowm, and crystal's) all disagree on how to escape ` within a `...` or <code>`</code> element.
<postmodern> oprypin, this actually renders correctly locally using ruby yard+kramdown, but screws up on github: https://github.com/postmodern/chars.rb#features
<postmodern> oprypin, https://github.com/postmodern/chars.cr#features different issues here with escaping ` inside of a ` `
<postmodern> i fear this is an unwinnable battle between the doc generator markdown implementation, and whatever werid version github is using to render markdown.
<FromGitter> <oprypin:matrix.org> postmodern, prior to me abandoning the use of that generator, i always used to rip out that generated readme. nobody needs it there. and no, GitHub Markdown is most definitely not the weird one of the two.
<FromGitter> <oprypin:matrix.org> i used to put a redirect to the main module's page. ⏎ and yes it's an unwinnable battle, but also a pointless battle
<postmodern> oprypin, the README is important as it's the first thing people see. it's the landing page. GitHub just needs to fix their unpredictable markdown generator...
<FromGitter> <oprypin:matrix.org> GitHub has the best markdown generator I know. and crystal's one never really reached completeness
<postmodern> i'm personally not a fan of how dry-rb projects have an almost empty README that just links to some external web page. I don't want to have to clink through links, just tell me what the project is, how to use it, etc
<FromGitter> <oprypin:matrix.org> postmodern, people can see the readme on github
<postmodern> oprypin, check out kramdown. it. just. works.
<FromGitter> <oprypin:matrix.org> why would i, if no system uses it
<FromGitter> <oprypin:matrix.org> for me github just works
<jhass[m]> problem is we all should be using commonmark and not markdown
<postmodern> oprypin, github does not work for me. it's markdown rendering does not seem render ``` or `\`` or <code>`</code> correctly causing a cascading effect https://github.com/postmodern/chars.rb#features if i work around said issies, then i break commonmark or ruby's kramdown (which is pretty much bullet proof)
<FromGitter> <oprypin:matrix.org> postmodern, anyway if you want good Markdown rendering and well integrated text+API docs, just use https://mkdocstrings.github.io/crystal/
<postmodern> oprypin, and does that work for the README.md on github as well :)
<jhass[m]> maybe it likes it as an entity? &
<jhass[m]> &#96;
<postmodern> see i want both proper documentation generation and a README which renders correctly on GitHub
<jhass[m]> probably not inside code tags
<FromGitter> <oprypin:matrix.org> eh there are definitely differences in Markdown rendering but much much fewer of them
<jhass[m]> GFM seems to be a commonmark derivative these days FWIW https://github.github.com/gfm/
<FromGitter> <oprypin:matrix.org> https://oprypin.github.io/crsfml/ is indeed same as https://github.com/oprypin/crsfml
<FromGitter> <oprypin:matrix.org> or i think this one is more convincing because it's more complicated html inside markdown
<postmodern> sorry to drag you all into this trivial and stupid problem, the day before the Crystal Conf
<postmodern> but "<code>`</code>" worked in kramdown, doesn't seem to work in `crystal doc`, so that seems like an issue
<FromGitter> <oprypin:matrix.org> again, crystal doc's Markdown is completely broken. *that* i would say is a waste of time
notzmv has joined #crystal-lang
notzmv has quit [Remote host closed the connection]
notzmv has joined #crystal-lang
notzmv has quit [Ping timeout: 246 seconds]
postmodern has quit [Quit: Leaving]
<FromGitter> <nanobowers> I've run into an issue where Crystal's Array#fill doesnt work the same as Ruby's (it doesnt allocate additional space, but throws an IndexError), but not sure if this is intentional. ⏎ ⏎ ```a.fill(9,1,2) ⏎ Unhandled exception: Index out of bounds (IndexError)``` [https://gitter.im/crystal-lang/crystal?at=60e5ab6b8c12474d8cf28f6c]
<FromGitter> <nanobowers> Unsure if the correct course of action is to file an issue, or manage this myself, though i havent seen a non-private method to increase capacity prior to running the #fill
<FromGitter> <Blacksmoke16> it should prob result in you not trying to overfill an array
<FromGitter> <Blacksmoke16> or maybe look into https://crystal-lang.org/api/master/Array.html#replace(other:Array):self-instance-method
<FromGitter> <nanobowers> not sure I grok your statement, are you suggesting this is an intentional safety feature to prevent me from overfilling the Array?
<FromGitter> <nanobowers> I just found that indexing w/ the range operator works, but this is arguably a little uglier: ⏎ ⏎ ```a = [10] ⏎ # a.fill(9,1,2) # doesnt work ⏎ a[1..2]=[9] * 2``` [https://gitter.im/crystal-lang/crystal?at=60e5af06bcb3e8060e054ea3]
<FromGitter> <Blacksmoke16> i imagine its the same sort of idea as why you can do `a[3] = 1`
<FromGitter> <nanobowers> I suppose it's the consistency part of it that's throwing me
<FromGitter> <nanobowers> E.g. ⏎ ⏎ ```a=[10] ⏎ a[1] = 0 # IndexError ⏎ a[1..1] = 0 # => [10, 0]``` [https://gitter.im/crystal-lang/crystal?at=60e5afe0258ebf6d920d1655]
Welog- has joined #crystal-lang
Welog has quit [Ping timeout: 265 seconds]
Welog- has quit [Remote host closed the connection]
Welog has joined #crystal-lang
notzmv has joined #crystal-lang
notzmv has quit [Ping timeout: 252 seconds]
_whitelogger has joined #crystal-lang
notzmv has joined #crystal-lang
<FromGitter> <RespiteSage> Is @redcodefinal around?
notzmv has quit [Remote host closed the connection]
<FromGitter> <oprypin:matrix.org> @RespiteSage: sadly only on discord. "sol.vin"
<FromGitter> <RespiteSage> Alright, thank you. I'll hop over there, then.
foxxx0 has quit [Quit: foxxx0]
lanodan has quit [Quit: WeeChat 3.1]
lanodan has joined #crystal-lang
<FromGitter> <RespiteSage> Wait, is the conference not actually happening on Discord?
<FromGitter> <RespiteSage> Or is that where the side discussions will be?
<FromGitter> <krzyczak> Hello. Can I have a question about the conference. I would like to attend but I won't be able to be on all sessions. Will the conference be recorded?
<FromGitter> <RespiteSage> Yes, I believe they've said that everything will be recorded and publicly available afterward.
<FromGitter> <krzyczak> Thanks.
lucf117 has joined #crystal-lang
<FromGitter> <rishavs> Anyone here knows how to generate a public key using RS256 given the modulus and exponent? I am at the end of my rope now trying to verify the Google IdToken with their public key. ⏎ https://www.googleapis.com/oauth2/v1/certshttps://www.googleapis.com/oauth2/v3/certs
<FromGitter> <mixflame> I succeeded with Amber Multichannel Redis Websocket Adapter guys
<FromGitter> <mixflame> made the test pass fast
<FromGitter> <mixflame> Rishav, have you looked at Crystal OpenSSL libraries and the Crypto module?
HumanG33k has quit [Quit: WeeChat 2.3]
<FromGitter> <rishavs> I started there but I couldn't find any method which looks like it does what I need
ur5us has joined #crystal-lang
notzmv has joined #crystal-lang
<FromGitter> <lodenos> Good Evening form LDN :) ⏎ I try to do that but I’ve  ⏎ ⏎ ```code paste, see link``` ⏎ ... [https://gitter.im/crystal-lang/crystal?at=60e626a3bcb3e8060e067549]
<FromGitter> <asterite> Yes. You can't call a macro from inside a macro.
<FromGitter> <Blacksmoke16> Does this even need to be a macro?
<FromGitter> <lodenos> Hum I see but the code can be more reable because I try to refactor 300 lignes code of pure macro
<FromGitter> <lodenos> @Blacksmoke16 It’s a exemple of my issue
<FromGitter> <Blacksmoke16> could prob do like `method_listing {{descriptions}}`
<FromGitter> <Blacksmoke16> but my questions still stands, dont really need a macro to do this type of thing
<FromGitter> <Blacksmoke16> related https://github.com/crystal-lang/crystal/issues/8835
<FromGitter> <lodenos> Ok I understand It’s was an exemple a somthing more complicated
<FromGitter> <Blacksmoke16> fair enough
<FromGitter> <lodenos> How can we organised a really big macro ?
<FromGitter> <lodenos> like 300 lines
<FromGitter> <Blacksmoke16> use variables, proper indenting etc
<FromGitter> <Blacksmoke16> got a link to it?
<FromGitter> <lodenos> It’s Horrible how it’s writed
<FromGitter> <lodenos> I don’t understand my own code
<FromGitter> <Blacksmoke16> oo another framework :P
<FromGitter> <lodenos> it’s more a library than a framework
<FromGitter> <Blacksmoke16> unfortunately there just isnt a good way to have clean macro code because you can't define reusable macro methods (yet?)
<FromGitter> <Blacksmoke16> could probably just add more comments or something, id also suggest writing some tests, be easier to ensure its working at least
<FromGitter> <lodenos> Right, thx for the anser, I hope one day we can reuse macro methods can be really powefull
<FromGitter> <Blacksmoke16> have you considered using annotations instead of the hash?
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=60e62c6d8a40b117284ceff9]
<FromGitter> <lodenos> I never try that on my own code
<FromGitter> <Blacksmoke16> looks like a good use case for them. However the downside is there isn't a way to iterate over all methods with an annotation, so would need to think of a way around that.
<FromGitter> <Blacksmoke16> but :shrug: just a thought
<FromGitter> <lodenos> With this lib I’ve only one object a bit useless
<FromGitter> <Blacksmoke16> hm?
<FromGitter> <lodenos> Be first here https://github.com/the-benchmarker/web-frameworks
<FromGitter> <Blacksmoke16> fair enough
<FromGitter> <Blacksmoke16> good luck
<FromGitter> <lodenos> I know XD
<FromGitter> <Blacksmoke16> benchmarks like that are mainly just testing the router, is fairly easy to have a faster framework, but then the framework itself isn't much of a framework
<FromGitter> <Blacksmoke16> pretty sure all the crystal ones on there are using `HTTP::Server`, so to be faster than that you might need to get creative
<FromGitter> <Blacksmoke16> https://github.com/S-YOU/h2o.cr such as binding to a c http server like this one did
<FromGitter> <lodenos> Learn to optimize to the maximum helps to understand in detail the suptiles of the language and its conception. I can imagine.
<FromGitter> <didactic-drunk> Why doesn't `Bytes.new` call `GC.malloc_atomic`? How does it get it's memory or any other `Pointer.malloc`? I'm attempting to track `malloc` usage and my monkey patches don't run.
<FromGitter> <oprypin:matrix.org> @didactic-drunk: it seems that the memory allocated for pointers isn't assumed to be atomic then
<FromGitter> <oprypin:matrix.org> atomic, as I understand, being a declaration that that memory will not contain GC-relevant pointers
<FromGitter> <oprypin:matrix.org> for arrays a choice was made to always assume that their memory will not contain undeclared pointers, that's where u get malloc_atomic, but it's not used always
notzmv has quit [Ping timeout: 252 seconds]
<FromGitter> <HertzDevil> crystal-lang/crystal#10643