ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.20.5 | Fund Crystal's development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
bjz_ has quit [Ping timeout: 264 seconds]
bjz has joined #crystal-lang
ome has joined #crystal-lang
mgarciaisaia1 has quit [Quit: Leaving.]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 255 seconds]
akwiatkowski has quit [Ping timeout: 255 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mgarciaisaia has joined #crystal-lang
m94asr has quit [Ping timeout: 248 seconds]
m94asr has joined #crystal-lang
bjz has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 252 seconds]
Raimondii is now known as Raimondi
Raimondi has quit [Remote host closed the connection]
Raimondi has joined #crystal-lang
mgarciaisaia has quit [Ping timeout: 240 seconds]
<Dreamer3> drosehn: Are there any docs on moving ones existing homebrew? I wonder how much of a disaster that is
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 276 seconds]
<FromGitter> <drosehn> Note that some installs will go *much* quicker when you're using `/usr/local`, because if you're using some other directory then `brew` decides that it needs to compile everything from scratch.
ome has quit [Quit: Connection closed for inactivity]
<Dreamer3> example?
<Dreamer3> i've never heard of that before
<Dreamer3> it should be aware of which dependencies are installed either way
<Dreamer3> my install downloads the binaries vs building just fine when they are available
<FromGitter> <drosehn> never heard of what before?
<Dreamer3> install speed differences because of differences in compile times
<Dreamer3> is there a ticket?
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 264 seconds]
Liothen has quit [Quit: The Dogmatic Law of Shadowsong]
Liothen has joined #crystal-lang
<jaitaiwan> no overload matches 'Array(String)#<<' with type Array(String)
<jaitaiwan> Overloads are:
<jaitaiwan> - Array(T)#<<(value : T)
<jaitaiwan> ^ anyone seen that before
<jaitaiwan> the message looks to me like it's saying "Unexpected Foo expecting Foo"
<jaitaiwan> Which is completely illogical
<FromGitter> <ezrast> It wants `String` and you're giving it `Array(String)`; consider `concat` instead of `<<`?
bmcginty has quit [Ping timeout: 240 seconds]
ome has joined #crystal-lang
ome has quit [K-Lined]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 248 seconds]
ome_ has joined #crystal-lang
ome_ is now known as ome
soveran has joined #crystal-lang
mark_66 has joined #crystal-lang
gloscombe has joined #crystal-lang
matp has quit [Remote host closed the connection]
matp has joined #crystal-lang
bmcginty has joined #crystal-lang
matp has quit [Remote host closed the connection]
matp has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 252 seconds]
Raimondii is now known as Raimondi
akwiatkowski has joined #crystal-lang
matp has quit [Remote host closed the connection]
matp has joined #crystal-lang
unshadow has joined #crystal-lang
<unshadow> I'm trying to create a program that uses the RSA part of OpenSSL, it seems Crystal does not support "https://ruby-doc.org/stdlib-2.0.0/libdoc/openssl/rdoc/OpenSSL/PKey/RSA.html" and those kind of operations , right ? or am I missing the file it sits at
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 252 seconds]
soveran has quit [Remote host closed the connection]
<splitty_> Hey, I need to somehow 'undef' a struct. Is that possible?
<splitty_> I want to test my custom Char class with the Crystal spec tool, but I keep getting errors because some constants are already defined.
<splitty_> That happens because Char is already included by spec. There doesn't seem to be a --prelude option for spec though.
akwiatkowski has quit [Ping timeout: 252 seconds]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
matp has quit [Remote host closed the connection]
matp has joined #crystal-lang
<unshadow> splitty_: I think you can pass all "build" flags to spec ( --prelude Use given file as prelude
<splitty_> Well unshadow if I add --prelude=empty I'm still getting the error
<splitty_> I think it's because spec requires char internally
<splitty_> Looks like this is an issue that I can't resolve in my codebase
<splitty_> The language would need to support private includes
<splitty_> Rust does that pretty nicely. You can either include a file privately (import) or publicly (import+export)
minus has quit [Ping timeout: 258 seconds]
RX14 has quit [Ping timeout: 258 seconds]
RX14 has joined #crystal-lang
akwiatkowski has joined #crystal-lang
minus has joined #crystal-lang
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mgarciaisaia has joined #crystal-lang
michael_campbell has joined #crystal-lang
<splitty_> Hey, I'm having some issues with conditional compilation
<splitty_> I'm trying to do the following:
<splitty_> {% if flag?(:test) %} module Std {% end %}
<splitty_> {% if flag?(:test) %} end {% end %}
<splitty_> # some code
<splitty_> For some reason, the last line is an error: Unexpected SPACE after `end`
gloscombe has quit [Read error: No route to host]
akwiatkowski has quit [Ping timeout: 255 seconds]
bew78 has joined #crystal-lang
matp has quit [Remote host closed the connection]
matp has joined #crystal-lang
pduncan has joined #crystal-lang
Raimondi has quit [Read error: Connection reset by peer]
mark_66 has quit [Remote host closed the connection]
Raimondi has joined #crystal-lang
DeBot has quit [Remote host closed the connection]
DeBot has joined #crystal-lang
gloscombe has joined #crystal-lang
Dreamer3 has quit [Ping timeout: 252 seconds]
pawnbox has joined #crystal-lang
akwiatkowski has joined #crystal-lang
mrus has joined #crystal-lang
soveran has quit [Remote host closed the connection]
<jeromegn> is there a way to block on IO? like wait for an io to have something to read from it?
<jeromegn> I'm trying to build a reverse TCP tunnel with a persistent connection to a "server". when the server receives a TCP request, it forwards it through the tunnel to the "client" which will then forward it to another TCP server locally.
<bew78> you could use IO.select with a timeout to block until something is there
<bew78> jeromegn: see above ^^^^^^^^^^
<jeromegn> yea I was reading about that. I'll give it a shot, thanks bew78
<bew78> you're welcome !
<jeromegn> that seems to return immediately
<jeromegn> I'll paste some code
<jeromegn> (maybe)
<jokke> Hi
mrus has quit [Ping timeout: 245 seconds]
<jokke> I've been off the crystal train for a while. How is crystal progressing? What are the next steps to 1.x and how far are we?
FromGitter has quit [Ping timeout: 256 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
mrus has joined #crystal-lang
<rkeene> Hmm, this bitcode plan didn't work well at all -- seems to be highly platform specific
<rkeene> Maybe this is a good use for pnacl
Renich has joined #crystal-lang
mrus has quit [Quit: leaving]
mrus has joined #crystal-lang
bjz has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
bew78 has quit [Ping timeout: 256 seconds]
<RX14> jeromegn, IO blocks by default, what do you mean?
<jeromegn> RX14: I see. I mean: some_io.read will return immediately even if there's nothing to read. Trying to figure out a way to block until there's something to read
<RX14> no it won't
<RX14> it does not do that
<RX14> it blocks
<jeromegn> mmm
Dreamer3 has joined #crystal-lang
<RX14> if read() returns with 0
<RX14> it's EOF
<jeromegn> hmm, you're right! wth was I doing before...
<jokke> RX14: thanks!
<RX14> rkeene, the crystal compiler will always output platform-specific code
<rkeene> RX14, The llvm-bitcode output
<RX14> of course
<RX14> there's embedded asm
<jokke> are there any plans for embedded devices support?
<jokke> *architectures
<RX14> jokke, we have arm support
<jokke> what
<jokke> srsly
<RX14> runs on raspi 1 and 3
<Papierkorb> yes
<RX14> yup
<jokke> !!!!
<jokke> omg!
<jokke> that is so awesome!
<RX14> avr seems a bit unrealistic
<RX14> but potentially possible
<RX14> given llvm support
<jokke> what about cortex m0?
<jokke> and such
<RX14> although most embedded is arm these days
<jokke> ^
<jokke> RX14: but the smaller arms
<RX14> it's generic arm support
<RX14> it's 1 target for both raspi versions iirc
<jokke> but how does this work with the standard lib
<jokke> i mean
<RX14> it's still tied to the gnu abi and libc
<jokke> ah
<jokke> yes
<jokke> ok
<RX14> you need linux
<jokke> yeah. that's what i thought
<jokke> any plans in supporting arm-none-eabi then? :)
<RX14> yes
<jokke> wow!
<RX14> --prelude=empty
<RX14> start with no stdlib and build your own
<RX14> people have built x86 OSes
<RX14> so should be fine for arm
<RX14> beyond my expertise though
<RX14> llvm does most of the heavy lifting
<jokke> this is exciting news
<Yxhuvud> splitty seems to find quite a lot of small issues when doing that though. But it is good that they are found so they can be fixed or improved
<RX14> yeah it's not really build for it
<jokke> splitty?
<RX14> but
<RX14> jokke, the guy making the os
<jokke> ah
<jokke> ok
<jokke> RX14: so, if i use --prelude=empty what remains?
<jokke> of the data structures i mean
<RX14> nothing really
<RX14> this is it
<RX14> pointer
<RX14> ints
<RX14> floats
<RX14> proc
<jokke> RX14: and what happens with something like foo = "bar"?
<jokke> char pointer?
<RX14> no
<RX14> String remains as a class
<RX14> just with no methods
<RX14> you have to reopen it and use the instance variables to provide your own
<Papierkorb> jokke: No memory management either, so no fancy string interpolation either, nor new :)
<jokke> i don't see any string definition anywhere
<jokke> Papierkorb: sure
<jokke> oh ok
<RX14> and thats some of the stuff that splitty was finding hard
<RX14> getting things to work where the compiler assumes the existance of the stdlib
<jokke> ah ok
<jokke> why does the compiler assume this?
<RX14> for example just using .as can generate code which requires String::Builder
<RX14> to build an exception message
<RX14> and then raise it
<jokke> oh wow
<RX14> all of which is implemented in the stdlib
<RX14> so you end up having to use as?
<RX14> and handle nil
<jokke> okay
<jokke> what c libs is the stdlib including?
<RX14> about half of them
<jokke> :D
<RX14> libgc, libevent, libc
<RX14> libpcre
<RX14> openssl
<jokke> mmh yeah
<RX14> we want to get that down
<RX14> but yeah
<jokke> RX14: and it's not possible to somehow use only a subset of the standard library?
<RX14> you can --prelude=empty can require yourself
<RX14> i was thinking of creating a minimal prelude
<RX14> but yeah
<jokke> i see
<RX14> probably libgc and libc would be the minimum
<jokke> there's no possibility to turn of gc?
<RX14> there is
<RX14> but it's just
<RX14> well thats prelude=empty
<RX14> thats what it is
<jokke> :W
<jokke> :D
<RX14> without gc you can't really allocate memory
<RX14> as there's no sane way to deallocate it
<jokke> ooh
<jokke> okay
<Papierkorb> RX14: https://gist.github.com/Papierkorb/ccf71f86d688427938f18160c948e757 still has some of my kernels requires in it, but most of it actually works "fine" if you're careful what you call
<RX14> because the stdlib isn't really built to support that well
<jokke> that's too bad
<Papierkorb> No one needs #to_s anyway *cough*
<RX14> you can call free() everywhere
<jokke> yeah!
<RX14> but you need to write your own stdlib with explicit deallocation
<jokke> why can't the stdlib have a delete method which would deallocate it?
<jokke> s/it/an object/
<RX14> because the stdlib doesn't do that itself
<jokke> ah
<jokke> yeah
<jokke> libgc
<RX14> you could
<RX14> thats what free() is
<RX14> but i'm saying you can't reuse the stdlib
<RX14> because it never really calls free()
<RX14> it just expects a GC
<RX14> Papierkorb, all that works without the GC?
<Papierkorb> RX14: It compiled just fine, as long you're careful to not use methods like #to_s. That's why String is actually missing in there, as it requires "io" which then wants libevent2 and friends. I basically took string.cr because of that and patched all of that out.
<RX14> yeah...
<RX14> maybe we should consider writing "empty prelude specs"
<RX14> force modularity a bit
<RX14> so that requiring string works without requiring libevent
<Papierkorb> If string would work without it would make lots of things much easier already
<RX14> yeah
<Papierkorb> that's really the biggest issue I faced
<rkeene> RX14, Right, I'm trying to build a Crystal that can be rebuilt for different platforms without requiring Crystal
<RX14> well requiring IO is fine
<RX14> but not
<RX14> IO::FileDescriptor
<RX14> so IO::memory is fine
<RX14> rkeene, you can't
<RX14> it's just like a C compiler
<RX14> you need a C compiler
<RX14> to compile it
<RX14> except C compilers dont have this issue because they iterate so much slower
<rkeene> Well, I mean -- I can... I just don't want to go to that extreme if possible
<RX14> and C is standardized
<rkeene> (Using pnacl-translate)
mrus has quit [Quit: leaving]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<RX14> hmm
<rkeene> pnacl is, in theory, supported by Crystal since it's really just Linux/le32 (no matter what the native platform is)
<Yxhuvud> also the cpu makers tend to write c compilers for their cpus (or mod the existing ones), so everyone else doesn't have to
<Yxhuvud> at least the exotic ones.
<RX14> yeah they just write llvm-backend these days I hear
<RX14> at least for the smaller CPUs
<jokke> so if i were to compile none-eabi arm code i would have to just compile with --prelude empty --cross-compile --mcpu ... --mattr ?
<RX14> jokke, probably?
<RX14> you can try it
<jokke> but don't i need a toolchain?
<RX14> the cross-compile generates an object file
<RX14> you need a toolchain to link
<jokke> yeah
<RX14> usually cross-compile is used for bootstrap
<RX14> so we just copy tyhe object file to the target arch
<RX14> and run the linker command the compiler spits out
<RX14> ofc thats assuming the target arch is a unix
<jokke> it spits out a linker command?
<RX14> yup
pawnbox_ has joined #crystal-lang
<jokke> i have to try this
<RX14> cc whatever
pawnbox has quit [Ping timeout: 240 seconds]
FromGitter has joined #crystal-lang
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
<jokke> gcc arm_test.o -o arm_test -rdynamic -L/usr/lib -L/usr/local/lib
<jokke> ?
FromGitter has quit [Read error: Connection reset by peer]
FromGitter has joined #crystal-lang
soveran has quit [Remote host closed the connection]
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
<RX14> jokke, yeah sounds about right
<RX14> dont need the -L with no libs
<RX14> i guess
FromGitter has quit [Read error: Connection reset by peer]
FromGitter has joined #crystal-lang
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
matp has quit [Remote host closed the connection]
matp has joined #crystal-lang
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
<jokke> RX14: i had a none eabi toolchain lying around...
FromGitter has quit [Read error: Connection reset by peer]
<jokke> oh
FromGitter has joined #crystal-lang
<jokke> sorry wrong paste
<jokke> there
FromGitter has quit [Read error: Connection reset by peer]
<jokke> so libc is a must even for prelude empty?
<RX14> no
<RX14> jokke, you need that nostdlib argument for the linker
<RX14> the binary doesn't require libc
<RX14> the linker just does it by default
<jokke> aah ok
<jokke> :)
<jokke> i'm poking around in the dark
<RX14> ohh yeah if you're booting without linux you're going to need a bootloader jokke
<RX14> no idea how that works on ARM
<jokke> hmm _start is the entry point for the runtime
<RX14> jokke, yup
<RX14> you can define your own though
<RX14> with fun instead of def
<RX14> with the correct signature to satisfy the bootloader
matp has quit [Remote host closed the connection]
<jokke> this is a bit over my head
<RX14> yeah
<jokke> :D
matp has joined #crystal-lang
<jokke> RX14: what would that help? isn't fun just for binding c functions?
<jokke> they still have to be linked
<RX14> no
<jokke> no?
<RX14> if you look
<RX14> you can define your own fun
<rkeene> What I really want is a brainfuck backend for LLVM
<jokke> oh!
<RX14> jokke, fun outside lib just defines a crystal function withouit a mangled name
<rkeene> (or, slightly better, an enhanced brainfuck -- like my "sf" which is more than an ISA, also includes a loader format)
<jokke> i see!
<RX14> rkeene, well if you write a LLVM backend, get it upstreamed, and port crystal
<rkeene> Google upstreamed Lanai, which might be close enough
<rkeene> I might be able to write an interpreter for it easily
<rkeene> Apparently they're going to release a simulator for it
<jokke> RX14: if i want to write my own prelude how can i use it?
<jokke> i tried --prelude ./my_prelude.cr but it complains that it can't find the file
<Papierkorb> jokke: --prelude=empty and then just require your own in
<jokke> mh ok
<jokke> i don't really need main
<RX14> rkeene, you could always just build qemu and build in a VM
<jokke> i would've replaced it with _start
<jokke> but ok
<rkeene> RX14, That might be less work overall, but I'd have to check to see how good the platform support is for TCG and user emulation (from what I recall, not so good)
FromGitter has joined #crystal-lang
FromGitter has quit [Remote host closed the connection]
gloscombe has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has quit [Ping timeout: 260 seconds]
<jokke> can i force code to be put in a specific section?
nlf has joined #crystal-lang
pawnbox_ has quit [Quit: gotta go guys.]
<RX14> jokke, thats the linker's job
<RX14> you can do that with a linker thingy
<jokke> RX14: heh
<jokke> yeah
<jokke> but how exactly?
<RX14> magic
<jokke> @[Link(...)]?
<RX14> jokke, no
<RX14> i dont know
<RX14> how
<RX14> this works
<RX14> but thats an example
<jokke> yeaah
<jokke> i know
<jokke> a linker script
<RX14> i honestly have no idea
<jokke> ok :)
<RX14> they just use make
<jokke> rust can do this
<RX14> how?
<jokke> in the code with a magic token like @[Link(...)] in crystal
<jokke> i think it's #[link_section = ".some_section"] or so
<jokke> uh i remembered correctly
<jokke> that's the interrupt vector
Dreamer3 has quit [Ping timeout: 260 seconds]
mgarciaisaia has quit [Quit: Leaving.]