<Papierkorb>
My desk is full of those. Work discourages using stickies, but they don't provide any other tool, so stickies it is there too.
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter>
<fridgerator> nah, I usually make notes in markdown files
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 250 seconds]
ome has joined #crystal-lang
<wmoxam>
I've got plenty of ideas stuck in Asana :p
<crystal-gh>
[crystal] asterite closed pull request #3697: Remove dot segments in uri path as per RFC 3986 6.2.2.3 (master...remove-dot-segments-in-uri-path) https://github.com/crystal-lang/crystal/pull/3697
<FromGitter>
<spalladino> @RX14 we got a spreadsheet with the issue categories from other communities, and a few candidate changes for crystal
<FromGitter>
<spalladino> We'll be probably be settling for an issue categorising scheme soon, and publish it
<FromGitter>
<spalladino> Next step will be to draw straws to see who gets to tag or re-tag everything :-P
<FromGitter>
<spalladino> And actually, one of the categories is shard-idea, so you could drop your ideas on the issue tracker and have other people join; though I'm unsure if the tracker is the best place for that collaboration
<FromGitter>
<spalladino> cc @petehuang
ome has quit [Quit: Connection closed for inactivity]
<FromGitter>
<petehuang> @spalladino put me in coach! i'm so far away from being able to contribute technically but i would love to do whatever i can to enable this community to focus on doing its best work
dtzu has quit [Quit: WeeChat 1.4]
vivus-ignis has joined #crystal-lang
bjz has joined #crystal-lang
pawnbox has quit [Ping timeout: 258 seconds]
pawnbox has joined #crystal-lang
matp has quit [Remote host closed the connection]
matp has joined #crystal-lang
Raimondi has quit [Read error: Connection reset by peer]
Raimondi has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
olek_poz has joined #crystal-lang
<aurelien>
Yesterday splitty_ says: <splitty_> I'm writing a kernel in Crystal
<aurelien>
what would be the interest of doing that? more efficiency? better hardware integration? ??
<jsaak>
i guess learning, or dreams
soveran has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
[sleep]splitty_ is now known as splitty_
<splitty_>
aurelien, I've written several kernels in C, Assembly, Rust, and even C# with a custom compiler.
<splitty_>
Writing kernels in C isn't fun, writing kernels in Assembly is fun but you can only get so far before going crazy
<splitty_>
Rust is a pretty nice language for writing kernels, and Crystal is just pure awesome
<splitty_>
I'm doing it to learn, and because OS dev is generally fun
<splitty_>
You learn so much about how the parts of the computer actually work under the hood
<aurelien>
splitty_: sounds cool
vivus-ignis1 has joined #crystal-lang
Raimondii has joined #crystal-lang
soveran has quit [Remote host closed the connection]
<Yxhuvud>
Ah, no inheritance involved. Then you don't. Unless it has arguments of different types.
<Yxhuvud>
I'd assume that you can also define the method in a module that you then include, to make it work with super, but I havn't actually tested that in crystal
<FromGitter>
<radarek> Btw, what do you think about monkey-patching in Crystal context? I have a feeling that it shouldn'e exist in crystal.
<FromGitter>
<radarek> I've been programming in Ruby since 2008 and beside first excitement I don't see any good reason to support monkey patching. It usually ends up with bugs & hidden problems.
<FromGitter>
<radarek> I'm only talking about overwriting existing method, adding new one is let say okeish.
<splitty_>
Yxhuvud, should I submit the format tool bugs to the Crystal repository or is there a special place for that?
<Yxhuvud>
I've submitted issues to the normal one before. It has a special tag that it will get
<akwiatkowski>
I try to be practical and unfortunately monkey approach is easier in my case.
<akwiatkowski>
Example. I'm writing blog engine and the core library is regular blog. But my blog posts has some additional features like tags (yep, it is standard), pois, geographic lands, towns, ... some other variables.
<FromGitter>
<radarek> <akwiatkowski> so do you require your blog engine library and overwrite some methods?
<akwiatkowski>
It's much easier to monkey patch and add method only related to theese not standard post attributes than to enforce lib user to intherit Blog, PostCollection and Post class. Probably using Blog(T) approach could be ok, but at this moment it's too big refactor.
<akwiatkowski>
Yes. I know it's not the best moral solution.
<akwiatkowski>
Post initialize title, image url, ... standard variables in lib, and there is method `initialize_custom` which is overriden and there I initialize all custom code (pois, lands, towns, ...)
<FromGitter>
<radarek> Yeah, it is a little bit strange for me. I've always used MP as a last resort.
<akwiatkowski>
Suggestions are welcome
<akwiatkowski>
But I'm not doing Blog(T) approach at this moment
<FromGitter>
<radarek> <akwiatkowski> Maybe you could share some excerpt from your engine? At least example showing your base class and how it's later monkey patched in specific scenarion.
<FromGitter>
<radarek> Does `data`directory contain example app that uses your blog engine?
<akwiatkowski>
radarek: yes
Philpax has joined #crystal-lang
<akwiatkowski>
note: text content is in Polish and everything is work in progress. `data` will be removed from this repo when ready.
bjz has joined #crystal-lang
<FromGitter>
<radarek> <akwiatkowski> Is there any advantage doing it that way instead of just using inheritance?
<FromGitter>
<radarek> I don't mind that it's Polish because I'm from Poland :D.
<akwiatkowski>
End user doesn't have to write or modify classes like Blog or PostCollection to use Array(CustomizedPost)
<FromGitter>
<radarek> Yeah, right.
<akwiatkowski>
I know it is possible to use Blog(T) style, but I could check this later
<akwiatkowski>
That would look too much hackish
<akwiatkowski>
It will scare most users. "Man, I'm not using generic types, I just wanted to add one field to post"
<FromGitter>
<radarek> Ok, so this kind of MP is in my standards acceptable one. You overwrite existing method but it's original implementation is empty. It's kind of Template Method pattern.
<FromGitter>
<radarek> What I worry about is using MP for overwriting existing methods in classes we don't own. I can even give example when it ends up with segfault.
<akwiatkowski>
It's quite easy to end with segfault
<FromGitter>
<asterite> Yxhuvud try previous_def instead of super
<yopp>
akwiatkowski, ah, right. Thanks!
<yopp>
Magic world of posix.1 in linux: getrusage The above struct [rusage] was taken from BSD 4.3 Reno. Not all fields are meaningful under Linux. Right now (Linux 2.4, 2.6) only the fields ru_utime, ru_stime, ru_minflt, ru_majflt, and ru_nswap are maintained.
<yopp>
¯\_(ツ)_/¯
<Yxhuvud>
asterite: well it wasn't I that needed it. But interesting to know that it actually is possible
<FromGitter>
<radarek> <akwiatkowski> Yes, it's extreme case but because it's doable in Crystal it worries me a bit.
<akwiatkowski>
I was looking for `previous_def` thanks, hovewer I think split custom code to other methos would be cleaner.
bjz has quit [Ping timeout: 252 seconds]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
bjz has joined #crystal-lang
<FromGitter>
<asterite> Monkey-patching is extremely useful for fixing buggy code until it is merged remotely. For example you find a bug in the std, you can fix it and not wait until the next release. Same holds for any shard. I find this to be the best case for this. Plus, if you redefine a method incorrectly chances are you will either get a compile error (crystal is typed), or if it's a core method like Array#size or Int#+ then it will crash
<FromGitter>
... immediately, so those monkey-patches are technically impossible to do
soveran has quit [Ping timeout: 256 seconds]
A124 has quit [Read error: No route to host]
<RX14>
@spalladino i'm sure if we split the issues up into segments we can work to re-tag everything together
A124 has joined #crystal-lang
<RX14>
I think monkey patching is quite useful, I've used it to patch in things to the standard library while waiting for the next release.
<FromGitter>
<asterite> But yeah, the general case is quite hard. In most cases not covering all case will make Nil somehow get into the type of the returned value and you'll get a compile error... and if not, it probably means your code is handling nil well
<FromGitter>
<asterite> but it's something that could be improved
<yopp>
It complains that it can't find mongoc-1.0, but `ld -lmongoc-1.0` only shows me the warning about missing`entry symbol _start`
A124 has joined #crystal-lang
<FromGitter>
<johnjansen> seasons greetings all . can anyone tell me what is wrong with the following … im having a festivity induced brain freeze ⏎ ⏎ ```d = nil.as(Time | Nil) ⏎ e = d.not_nil!.to_utc.to_s("%Y-%m-%dT%H:%M:%SZ")``` [https://gitter.im/crystal-lang/crystal?at=585d6f11c5a4e0233bc1be56]
<FromGitter>
<asterite> Well, d is nil... what did you expect?
<FromGitter>
<johnjansen> hi Ary — haha … so the real line setting `d` is `d = Time.parse(date_string, "%F") rescue nil`
<FromGitter>
<asterite> So maybe the parsing fails and you are getting nil? What are the contents of date_string?
<FromGitter>
<johnjansen> where date_string is what you would expect, except when its something else … like this `2022-01-dfdsf01`
<FromGitter>
<johnjansen> so it can fail yes
<FromGitter>
<johnjansen> thats the idea behind the rescue and the subsequent not_nil!
<FromGitter>
<radarek> not_nill! raise exception when d is set to `nil`
<FromGitter>
<johnjansen> thanks @radarek … im an idiot some days
<FromGitter>
<asterite> you probably want `d.try &.to_utc.to_s(...)`, or maybe `if d; ...; else; ...; end` or something like that
<FromGitter>
<asterite> (note that in the try version the result can still be nil)
<FromGitter>
<johnjansen> thats exactly what i want, thanks Ary … and merry christmas
<FromGitter>
<asterite> to you too :-)
matp_ has joined #crystal-lang
matp has quit [Ping timeout: 260 seconds]
akwiatkowski has joined #crystal-lang
<crystal-gh>
[crystal] Sija opened pull request #3759: Docs cleanup (master...docs-cleanup) https://git.io/vMvIS
greengriminal has joined #crystal-lang
<crystal-gh>
[crystal] Sija opened pull request #3760: Remove outdated TODOS (master...remove-todos) https://git.io/vMvm5
Arney has quit [Quit: Lost terminal]
ponga has quit [Quit: Connection closed for inactivity]
pawnbox has quit [Remote host closed the connection]
bjz has joined #crystal-lang
soveran has joined #crystal-lang
<splitty_>
Do Crystal `fun`s adhere to cdecl?
soveran has quit [Ping timeout: 256 seconds]
<BlaXpirit>
splitty_, well yeah if understand correctly, that's their whole point
<splitty_>
Okay, thanks. I was having issues with a struct passed on the stack and was wondering whether I should mark the function Naked and handle that stuff myself
<RX14>
you can always manually declare the calling convention
<RX14>
if it's inter-crystal code then any calling should work flawlessly
<RX14>
otherwise it's a bug
<RX14>
actually crystal always uses cdecl by default I think
binBASH has joined #crystal-lang
<RX14>
from what I read Cdecl is what the GNU abis use throughout
<RX14>
but i'm not knowledgable about such things
<RX14>
splitty_, ^
<splitty_>
Yeah, should be cdecl
<splitty_>
This is really strange :D
<RX14>
i don't think def vs fun changes the CC
<RX14>
just the mangling
<RX14>
and symbol export
<RX14>
not that that matters to you
<splitty_>
RX14, apparently the size of my kernel is 40 bytes, according to the multiboot info structure.
pawnbox has joined #crystal-lang
<splitty_>
That's just impossible and I can't figure out what's happening
<RX14>
no idea
<RX14>
show me the code and i'll have a look
<Yxhuvud>
40 bytes seems small enough that it should be possible to look at the output
<splitty_>
This is strange.. Maybe that value is in kb, that would make more sense
<RX14>
hmm
<splitty_>
The kernel is 36kb and the multiboot info struct reports a value of 40
<RX14>
any docs?
<splitty_>
Just the official multiboot docs on gnu.org, but they are.. really badly documented
<RX14>
hah
<splitty_>
"These indicate where the section header table from an ELF kernel is, the size of each entry, number of entries, and the string table used as the index of names."
<splitty_>
The size of each entry. How helpful.
<RX14>
well i would assume in bytes
<RX14>
if it's each entry
<RX14>
i could imagine 40 bytes for one of the ELF sections
<splitty_>
Yeah, but then it makes no sense that the value is 40
<RX14>
but
<RX14>
it says 40 bytes for a ELF section
<RX14>
not which ELF section
<splitty_>
hmm..
<splitty_>
All I need is an address at the end of the kernel, so I can place my heap there.
<RX14>
well actually
<splitty_>
Currently I'm doing elf_addr + elf_size
<RX14>
ELF entry size
<RX14>
would probably be the size of the ELF entry
<RX14>
i.e. the metadata
<RX14>
because it's size + number
<RX14>
which implies they're all the same size
<RX14>
i.e metadata
<RX14>
"section header table" which would contain "elf entries" which are all metadata, and it gives you the size of each one + how many there are
<RX14>
maybe
<RX14>
i'm guessing here
<splitty_>
"They correspond to the ‘shdr_*’ entries (‘shdr_num’, etc.) in the Executable and Linkable Format (elf) specification in the program header. All sections are loaded, and the physical address fields of the elf section header then refer to where the sections are in memory".
<splitty_>
Just found this.
<RX14>
so it's metadata?
<splitty_>
I have no idea what "the shdr_* entries" are
<RX14>
read the ELF spec?
<splitty_>
Yeah I'm doing that right now
<RX14>
well how big is the address space you're working with? if it's massive can't you just take the start address and add 10 magabytes?
pilne has joined #crystal-lang
<splitty_>
RX14, not sure..
<splitty_>
There has to be a better way.
<splitty_>
RX14, would I be able to access a linker symbol from Crystal?
<RX14>
if you were 64bit you could just reserve 1TiB for the kernel code and have done with it!
<splitty_>
Right.. ^^
<splitty_>
Well I want this to be portable so I can't really just get long-mode going and hope that it fixes everything
<RX14>
yeah
<RX14>
well i would venture to stack overflow then I guess
<splitty_>
RX14, in the linker script I could easily define a linker symbol for the end of the kernel
<RX14>
or mailinglists or sth
<splitty_>
And I doubt there's a guide on how to use linker symbols in Crystal on SO :P
<RX14>
uhh
<RX14>
i don't even know what linker symbols are
<RX14>
how would you use them in C?
<splitty_>
RX14, they're basically pointers defined in the linker
<RX14>
would it be like an external veriable?
<splitty_>
Yep, just an external variable. No idea how that works in Crystal tyhough
<splitty_>
though*
<RX14>
ok
<RX14>
you want to define a lib section
<RX14>
and use $foo to declare an external variable named foo
<splitty_>
I think what I want is the address, not the value
<RX14>
oh yes it would be pointerof(foo) in that case
<splitty_>
and foo would be UInt32? Or a Pointer itself?
<splitty_>
Okay, I think I got a usable value
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<RX14>
it wouldn't matter would it?
<RX14>
it could be any type and only the address of it would matter
<splitty_>
Yeah I guess that's right
<splitty_>
Thank you for your help
<RX14>
no problem
<binBASH>
Question regarding C bindings. Is it only possible to have them for libs or can you call C code somehow as well? I'm especially looking for using the netmap framework from within Crystal
<RX14>
what do you mean?
<splitty_>
You can only define C structs within libs, if that's what you mean
<RX14>
binBASH, i'm not sure what you mean by "libs" vs "C code"
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
greengriminal has quit [Ping timeout: 265 seconds]
greengriminal has joined #crystal-lang
<binBASH>
RX14: I want to call C code not inside a lib