<Papierkorb>
Now, I just .. have to .. err .. cross compile like the whole stdlib somehow.
<FromGitter>
<piedoom> What are you making?
<Papierkorb>
Well, it's a operating system kernel, bootloaded through GRUB and then bootstrapped through a bunch of ASM which then jumps into the Crystal code
<FromGitter>
<piedoom> damn, that sounds really cool
<Papierkorb>
As in, a proof that in theory, you can write operating systems in pure Crystal ... and some assembler to back it up
<FromGitter>
<piedoom> soon we'll all be writing crystal on CrystalOS :)
<Papierkorb>
In fact, it runs in x64 ("Long Mode"). Mostly because cross compiling to 32bit was too much of a hassle :P
<Papierkorb>
I have to check some licenses first, and then figure out how I could automate the building of the hdd image you can boot later on. And then I could actually put on github so ppl can play with that stuff. Though, I named it "Shooting Star". Don't ask me why, I forgot
Ven_ has quit [Ping timeout: 264 seconds]
Ven_ has joined #crystal-lang
<FromGitter>
<piedoom> I think that's a pretty good name
<FromGitter>
<piedoom> very crystal-y
Ven_ has quit [Ping timeout: 244 seconds]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 265 seconds]
Philpax has joined #crystal-lang
bjz has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
soveran has joined #crystal-lang
mgarciaisaia has quit [Client Quit]
soveran has quit [Ping timeout: 240 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 244 seconds]
qard has quit [Read error: Connection reset by peer]
qard has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 248 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 248 seconds]
qard_ has joined #crystal-lang
qard has quit [Ping timeout: 250 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 272 seconds]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 265 seconds]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 265 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
willl has joined #crystal-lang
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 240 seconds]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 264 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Ping timeout: 265 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Ven_ has joined #crystal-lang
Ven_ has quit [Read error: Connection reset by peer]
Ven_ has joined #crystal-lang
Ven_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
<RX14>
wow a crystal OS, I thought someone would make one eventually
<RX14>
Papierkorb posted it last night, probably not on github yet
pawnbox has quit [Ping timeout: 248 seconds]
<FromGitter>
<sdogruyol> Cool.
<txdv>
EINFÜGEN
<txdv>
its a main function
<txdv>
which writes stuff into a buffer
<txdv>
hardly an operating system
<Val>
is it possible to include a module dynamically or is it another way to use an already implemented interface based on a class or a module name ?
<Val>
should this be done at compile time (with macros) only ?
<RX14>
Val, i'm not quite sure what you want to do
<Val>
define multiple implementation of an interface but take the proper one at run time
<Val>
like include a mixin dynamically based on the module name in Ruby
<RX14>
seems like a strange thing to do but you probably could do it with macros
willl has quit [Quit: Connection closed for inactivity]
<RX14>
can you explain your problem in a wider context?
<Val>
Wait I try to be clear and short...
pawnbox has joined #crystal-lang
<Val>
Imagine a program that read a configuration to process an ordonned list of action.
<Val>
Each action share the same configuration struct, with a YAML mapping (taken from configuration file).
<Val>
Each action implement the same interface to be executed.
<Val>
I made a class to get the YAML mapping and define the interface (raising exception when called).
<Val>
I try to implement each different action, I didn't find a way to make it dynamically like im Ruby (by simply include the related implementation mixin from a configuration field like the "name" one).
<Val>
What design pattern could be used in Crystal to handle this ?
Oliphaunte has joined #crystal-lang
<Val>
as include has to be done at compile time...
<RX14>
well, the easiest way is to have a case statement which maps strings to implementations
<RX14>
such as implementation_for("name") : Action
<RX14>
or something
<RX14>
if you really want you can make that case statement be generated by macros but i would just make it manual
<Val>
Ok, so I will split configuration mapping & implementations
Oliphaunte has quit [Ping timeout: 240 seconds]
<Val>
thx
<RX14>
Val, you might want to make the common superclass abstract
<FromGitter>
<Val> For the interface yes
<RX14>
yes
<Papierkorb>
txdv: Of course that's not an "OS", it's a PoC that you can use Crystal for that
<FromGitter>
<sdogruyol> How's the performance
<Papierkorb>
It puts stuff on the screen real fast
<Papierkorb>
So, pretty good?
<Papierkorb>
The generated ASM code LLVM comes up with isn't all too bad actually
<RX14>
the code is doing so little there's not much performance to measure
<FromGitter>
<sdogruyol> Are you running that with quemu
<RX14>
writing to the screen is just setting memory
<Papierkorb>
Well yes, that's QEMU
soveran has quit [Remote host closed the connection]
m4t has joined #crystal-lang
<m4t>
hello
<m4t>
I'm trying to do self-referencing in a class, but result an infinite loop and I don't understand why
<m4t>
even with the attribute set to nil or not, it loop in the « child » of to_hash
Oliphaunte has joined #crystal-lang
trapped has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 276 seconds]
trapped has quit [Read error: Connection reset by peer]
<RX14>
huh i can't get it to work either
<m4t>
tried with « if else », it's not the ternary operation
<RX14>
no, it's the type
<RX14>
the compiler doesn't seem to hanbdle the recursive type
<RX14>
but i'm sure it used to
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 272 seconds]
<BlaXpirit>
m4t, why do you think you need a Hash here?
<RX14>
BlaXpirit, it should work though
<RX14>
recursive types should work
<BlaXpirit>
RX14, it's not the type itself, it's the crazy hash
<RX14>
it's not a crazy hash
<RX14>
the type makes sense
<RX14>
even alias FooHash = Hash(String, FooHash) works as a type
<RX14>
well, should work
<RX14>
you can create an empty foohash and add it as a value to itself
<m4t>
BlaXpirit: I need to manipulate an object that have too many attributes, so I export to hash, then I do manipulation & validations, then I re-import data in the original object
<RX14>
m4t, why do you need to export to hash to do validations..?
<BlaXpirit>
sounds like someone comes from Ruby :|
<m4t>
yep ^^
<RX14>
regardless of whether this use of hashes is stupid or not, it should be possible to do
<m4t>
I'm converting an old ruby app, so I will review the logic too
<RX14>
hashes are actually harder to manipulate than objects m4t
qard_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<m4t>
Yeah after check I can use the object and reload it if validations fails, don't known why I was in a logic of hash export then re-import
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 255 seconds]
jamie_ca has quit [Remote host closed the connection]
jamie_ca has joined #crystal-lang
ebraga has joined #crystal-lang
Oliphaunte has joined #crystal-lang
A124 has quit [Quit: '']
Oliphaunte has quit [Ping timeout: 240 seconds]
bjz has joined #crystal-lang
A124 has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 272 seconds]
ebraga has quit [Ping timeout: 265 seconds]
bew78 has joined #crystal-lang
bjz_ has quit [Read error: Connection reset by peer]
bjz has joined #crystal-lang
Ven_ has joined #crystal-lang
bew78 has quit [Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org]
Ven_ has quit [Ping timeout: 255 seconds]
soveran has joined #crystal-lang
bjz has quit [Read error: Connection reset by peer]
Ven_ has joined #crystal-lang
bjz has joined #crystal-lang
soveran has quit [Ping timeout: 248 seconds]
bjz has quit [Read error: Connection reset by peer]
bjz has joined #crystal-lang
bjz has quit [Read error: Connection reset by peer]
Ven_ has quit [Read error: Connection reset by peer]
Ven__ has joined #crystal-lang
bjz has joined #crystal-lang
bjz has quit [Read error: Connection reset by peer]
bjz has joined #crystal-lang
bjz has quit [Read error: Connection reset by peer]
Ven__ has quit [Ping timeout: 244 seconds]
Ven_ has joined #crystal-lang
bjz has joined #crystal-lang
Ven_ has quit [Ping timeout: 264 seconds]
Oliphaunte has joined #crystal-lang
Ven_ has joined #crystal-lang
soveran has joined #crystal-lang
<FromGitter>
<raydf> @m4t there's also a property macro, you're using a getter and a setter over the same property name "child".
<RX14>
I found someone's crystal project who had a spec to make sure their Library::VERSION was the same as in their shards file, and I can't find it again
<m4t>
@raydf: good catch, thanks for the tip ;)
<BlaXpirit>
m4t, well if you're accepting tips, here's another one `(@child.nil? ? nil : @child.not_nil!.to_hash)` -> `(@child ? @child.not_nil!.to_hash : nil)` -> `@child.try(&.to_hash)`
<m4t>
indeed it's cleaner, thanks ;)
<RX14>
how does "cast from File to IO failed" even happen
<RX14>
WTF
<m4t>
btw: I created a custom json builder to export to the frontend, self-referencing work perfectly
ebraga has joined #crystal-lang
<RX14>
nice
<Papierkorb>
How do I store static data (structures) in Crystal in such a way that it's stored in the .rodata section?
<RX14>
no, because strings can only contain Unicode codepoints
<RX14>
or UTF-8 data
<Papierkorb>
Well I can fake it through "\u{..}"
<RX14>
the best way is to encode it with base64
<RX14>
and then decode it from the literal
<RX14>
but then it's not actually rodata when it's decoded
<Papierkorb>
I don't have a working memory, I have to store it decoded in there :)
<Papierkorb>
Ah well nothing a generator script or even a macro maybe can't fix
<RX14>
why not fix memory :/
Ven_ has quit [Ping timeout: 276 seconds]
<Papierkorb>
Well I need to load the GDT and friends first so I can actually start thinking about a PMM then VMM then kmalloc then GC and at this point, I actually have working memory :P
<RX14>
doesnt UEFI do most of that for you?
<Papierkorb>
Multiboot*, it does a lot but the initial settings aren't what you really want.
Ven_ has joined #crystal-lang
<RX14>
huh
ebraga has quit [Ping timeout: 255 seconds]
Ven_ has quit [Ping timeout: 244 seconds]
kulelu88 has joined #crystal-lang
Ven_ has joined #crystal-lang
crystal-lang069 has joined #crystal-lang
Ven_ has quit [Ping timeout: 244 seconds]
crystal-lang069 has quit [Ping timeout: 240 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Ping timeout: 272 seconds]
Oliphaunte has quit [Remote host closed the connection]
Ven_ has joined #crystal-lang
kulelu88 has quit [Quit: Leaving]
kulelu88 has joined #crystal-lang
soveran has quit [Remote host closed the connection]
Ven_ has quit [Ping timeout: 265 seconds]
Ven_ has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
Philpax has quit [Ping timeout: 265 seconds]
soveran has quit [Ping timeout: 255 seconds]
Oliphaunte has joined #crystal-lang
Ven_ has quit [Ping timeout: 244 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Ping timeout: 248 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Ping timeout: 265 seconds]
Ven_ has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
bazaar has quit [Quit: leaving]
Ven_ has quit [Ping timeout: 264 seconds]
Ven_ has joined #crystal-lang
bazaar has joined #crystal-lang
Ven_ has quit [Ping timeout: 240 seconds]
Ven_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
Ven_ has quit [Ping timeout: 272 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Ping timeout: 244 seconds]
Ven_ has joined #crystal-lang
Ven__ has joined #crystal-lang
Ven_ has quit [Read error: Connection reset by peer]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<RX14>
i'm on a bug-finding roll
pawnbox has quit [Ping timeout: 276 seconds]
pawnbox has joined #crystal-lang
Ven__ has quit [Ping timeout: 265 seconds]
Ven_ has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 265 seconds]
Ven_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Oliphaunte has joined #crystal-lang
qard has joined #crystal-lang
Ven_ has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 244 seconds]
Ven_ has quit [Ping timeout: 264 seconds]
Ven_ has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
Ven_ has quit [Ping timeout: 240 seconds]
Oliphaunte has quit [Ping timeout: 250 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Ping timeout: 265 seconds]
Ven_ has joined #crystal-lang
qard has quit [Read error: Connection reset by peer]
m4t has quit [Remote host closed the connection]
qard has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
Oliphaunte has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
soveran has quit [Ping timeout: 250 seconds]
Oliphaunte has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
Ven_ has quit [Ping timeout: 240 seconds]
Ven_ has joined #crystal-lang
Ven_ has quit [Ping timeout: 240 seconds]
Oliphaunte has joined #crystal-lang
Ven_ has joined #crystal-lang
Ven_ has quit [Ping timeout: 250 seconds]
Ven_ has joined #crystal-lang
A124 has quit [Quit: '']
A124 has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
pawnbox has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
pawnbox has quit [Ping timeout: 250 seconds]
Ven_ has quit [Ping timeout: 264 seconds]
Ven_ has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
Ven_ has quit [Ping timeout: 265 seconds]
bazaar has quit [Remote host closed the connection]
bazaar has joined #crystal-lang
Ven_ has joined #crystal-lang
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
<RX14>
@piedoom the best thing to do is recreate the whole object hierarchy using objects. If you really don't need any of the extra data, use a pull parser
<FromGitter>
<piedoom> Do you mean in reguard to my second post? I accidentally linked the wrong gist at first.
<FromGitter>
<piedoom> Also, I can't seem to write correctly... should be `TextPost < BasePost`
<RX14>
JSON.mapping will override the method from the superclass
<RX14>
your best option is to include the superclass stuff in the subclass - or even better don't use object hierarchy at all
<RX14>
i can't see which messages are deleted from ITC
<RX14>
IRC*
<FromGitter>
<piedoom> I know inheritance is overused but in the situation it makes a lot of sense with the data I'm dealing with
<FromGitter>
<piedoom> I have about ~7 different post types with this API and all always have about 20 properties in common
<RX14>
well there isn't currently a way to do that
<RX14>
your best bet is to open an issue about it
<FromGitter>
<piedoom> Will do that, thanks.
soveran has quit [Remote host closed the connection]
Ven_ has quit [Ping timeout: 264 seconds]
Oliphaunte has quit [Remote host closed the connection]
ebraga has joined #crystal-lang
<crystal-gh>
[crystal] asterite pushed 2 new commits to master: https://git.io/viXmI
<crystal-gh>
crystal/master ad83832 Ary Borenszweig: Compiler: fixed incorret type-flow related to begin/rescue and blocks. Fixes #3324
<crystal-gh>
crystal/master c32229b Ary Borenszweig: Compiler: fixed bug related to module including module. Fixes #3323
qard has quit [Quit: My Mac has gone to sleep. ZZZzzz…]