<FromGitter>
<j8r> In fact, `UserID` is a struct, which holds also class metadata for Swagger
<FromGitter>
<Blacksmoke16> > Athena is even better type safe, but at the expense of being more verbose ⏎ ⏎ dunno if you saw it or not, but i also added kemal/sinatra style route definitions
<FromGitter>
<Blacksmoke16> ah, as like class methods/
return0e has quit [Remote host closed the connection]
<FromGitter>
<rurounijones_gitlab> So I am not very familiar with the state of Windows support right now. Is it possible to compile a crystal binary for Windows from Linux?
<FromGitter>
<Blacksmoke16> triggered when a release is created, builds a static prod binary, and uploads it to that release
<FromGitter>
<watzon> 👏
<FromGitter>
<watzon> Very nice
<FromGitter>
<Blacksmoke16> feel free to adapt as needed
return0e has quit [Ping timeout: 268 seconds]
<FromGitter>
<Blacksmoke16> reasoning for updating libxml2 and libyaml is i want to make sure the binary gets the most up to date versions of them, since the image itself would only include the version that was available when it was built correct?
_whitelogger has joined #crystal-lang
martinium has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
martinium has joined #crystal-lang
<FromGitter>
<halfdan> How do I convert a String to a Pointer(UInt8)?
<FromGitter>
<halfdan> pointerof() gives me a Pointer(String)
<FromGitter>
<watzon> Are you trying to do that for a C library?
<FromGitter>
<watzon> `to_unsafe` should do it though
<FromGitter>
<grkek> my stupid attempt at making an ui framework
<FromGitter>
<j8r> @c910335 use records instead of NamedTuples
JuanMiguel has joined #crystal-lang
JuanMiguel has quit [Remote host closed the connection]
alex`` has quit [Ping timeout: 272 seconds]
alex`` has joined #crystal-lang
sorcus has quit [Quit: WeeChat 2.7]
sorcus has joined #crystal-lang
uu91 has quit [Remote host closed the connection]
<FromGitter>
<j8r> nice, in an initial benchmark test it seems there is no huge performance regression. ⏎ For now my router is more efficient in about 20% than Kemal, but we can't take any conclusion since it is a micro-benchmark. Plus, there are a lot less features
_whitelogger has joined #crystal-lang
<FromGitter>
<grkek> Nice
<FromGitter>
<j8r> I just hope there is interest of having a router with swagger api docs support 😅
<FromGitter>
<Daniel-Worrall> Whew, I was getting ssl issues on a minimal install, solved it by installing curl :^)
<FromGitter>
<Daniel-Worrall> I'm not a devops guy
<FromGitter>
<j8r> how does installing curl will solve the issue?\
<FromGitter>
<Daniel-Worrall> it resolves local ssl certs during install
<FromGitter>
<j8r> maybe it installs the ca certificates package too
<FromGitter>
<j8r> ho ok, stange
<FromGitter>
<Daniel-Worrall> ah, ca-certificates will be it
<FromGitter>
<Daniel-Worrall> I only grabbed curl to try installing crystal
<FromGitter>
<Daniel-Worrall> was confused cause I built statically
<FromGitter>
<Daniel-Worrall> well I'm learning things every day
<FromGitter>
<j8r> no need to install crystal if the binary is statically linked
<FromGitter>
<j8r> the linkage is only supported on Alpine Linux though
<FromGitter>
<Daniel-Worrall> yeah, I'm using the new official docker image for it
<FromGitter>
<Daniel-Worrall> I didn't get to installing crystal anyway, had to install curl to get the install script so that helped me work out my issues
<FromGitter>
<Daniel-Worrall> oddly enough, this minimal install has nano and not vim
<FromGitter>
<Daniel-Worrall> yup, definitely the ca-certs
<FromGitter>
<grkek> @j8r That is actually what I was making for grip
<FromGitter>
<grkek> but then decided too much pain
<FromGitter>
<grkek> to generate the swagger json :D
<FromGitter>
<grkek> if you do that I might adapt it
<FromGitter>
<grkek> that would be nice
<FromGitter>
<grkek> Did some work on IU, it is slowly getting into shape
<FromGitter>
<grkek> but I just wanted to display all the cool features
<FromGitter>
<grkek> :D
<FromGitter>
<grkek> I mean it might be long but at least it is easy
<FromGitter>
<j8r> IMHO it will be better to have a very simple, basic example, and then eventually a longer, more complex one
<FromGitter>
<grkek> Now tell me how is that example hard
<FromGitter>
<grkek> 3 identical classes
<FromGitter>
<grkek> and a 1 websocket class
<FromGitter>
<grkek> displaying all the routes
<FromGitter>
<grkek> you can get
<FromGitter>
<grkek> and displaying the router abilities
<FromGitter>
<grkek> plus the params and etc
<FromGitter>
<j8r> the issue is not really because hard
<FromGitter>
<j8r> but if we don't know anything about the project
<FromGitter>
<j8r> we may think of having lot of boilerplating for just having a basic, simple server
<FromGitter>
<grkek> When you are looking for an REST API framework you might have a basic understanding of what
<FromGitter>
<grkek> get, post, put, update and routing is
<FromGitter>
<grkek> right ?
<FromGitter>
<grkek> I mean you can ignore other methods
<FromGitter>
<grkek> can just put one
<FromGitter>
<Daniel-Worrall> A readme isn't documentation
<FromGitter>
<Daniel-Worrall> Wait, so you forked kemal and didn't even fix the global pollution?
<FromGitter>
<Daniel-Worrall> Super Simple: 4 pages of text *close*
<FromGitter>
<j8r> I mean, we even have to scroll to copy paste the simple example 😕
<FromGitter>
<j8r> but this one would be good on a guide/documentation
<FromGitter>
<Daniel-Worrall> ^
<FromGitter>
<j8r> I agree with @Daniel-Worrall 👍
<FromGitter>
<j8r> a way to avoid pollution and having a good DSL is using `with self yield`
<FromGitter>
<grkek> Global pollution is not a concern rn but I might change the readme a bit :)
<FromGitter>
<tenebrousedge> it's fair if it's not one of your concerns. It's clearly not the worst idea for a framework; lots of people do it. Personally I find it a bit obnoxious
<FromGitter>
<grkek> Ill work on that mate
<FromGitter>
<dscottboggs_gitlab> does the stdlib offer a timeout facility? I.E. only wait 30 seconds for user input and then just move on?
<FromGitter>
<grkek> Fixed the global pollution for the IU framework @tenebrousedge thank you for the tip
<FromGitter>
<grkek> Now I am going to work on grip
<FromGitter>
<tenebrousedge> :plus1:
<FromGitter>
<grkek> I didnt even know that was an issue :D sorry
<FromGitter>
<grkek> if I upset you
<FromGitter>
<tenebrousedge> oh, not at all
<FromGitter>
<grkek> I am glad about that
<FromGitter>
<dscottboggs_gitlab> uh, does `forall` not work anymore?
<FromGitter>
<grkek> looks normal to you @Blacksmoke16
<FromGitter>
<grkek> ?
* FromGitter
* tenebrousedge is attacked by a code block
<FromGitter>
<Blacksmoke16> I think you can do a timeout in the select directly btw
<FromGitter>
<grkek> @tenebrousedge how did you do that :o
<FromGitter>
<j8r> > @tenebrousedge is attacked by a code block ⏎ ⏎ lol
<FromGitter>
<tenebrousedge> "/me does an action"
* FromGitter
* grkek WOAH
* FromGitter
* grkek This is like skype
<FromGitter>
<dscottboggs_gitlab> @Blacksmoke16 idk there's no documentation anywhere
<FromGitter>
<grkek> @tenebrousedge does that fix the pollution what I did up there ?
<FromGitter>
<tenebrousedge> rather, Skype and gitter are like IRC
<FromGitter>
<grkek> ;)
<FromGitter>
<dscottboggs_gitlab> gah `typeof(block)` is `Proc(T)` not `T` I'll have to go with the generic struct idea
<FromGitter>
<tenebrousedge> @dscottboggs_gitlab or use a macro to snag the type
<FromGitter>
<tenebrousedge> @grkek I'm not entirely sure what's going on in your code, but it's probably okay if the `get` and `post` methods can be included at the top level, just as long as they're not defined there
<FromGitter>
<Blacksmoke16> the problem would require prob a redesign of the framework
<FromGitter>
<Blacksmoke16> that example is more of just a bandaid
<FromGitter>
<grkek> Hm you are right
<FromGitter>
<grkek> It will require a redesign
<FromGitter>
<Blacksmoke16> which at that point it's not really a kemal clone anymore ;p
<FromGitter>
<grkek> For now I will just update the readme
<FromGitter>
<Blacksmoke16> since you're using inheritance, couldnt you define them in that parent class?
<FromGitter>
<grkek> You are right
<FromGitter>
<grkek> But
<FromGitter>
<grkek> you would still need the macros
<FromGitter>
<grkek> to define routes
<FromGitter>
<Blacksmoke16> you can make the macros private in the parent type
<FromGitter>
<grkek> What do you mean ?
<FromGitter>
<Blacksmoke16> would still be usable by children types
<FromGitter>
<grkek> Yes but you would still need the global pollution at this point to define macros
<FromGitter>
<grkek> oh no that looks ugly @Daniel-Worrall
<FromGitter>
<Daniel-Worrall> no, global pollution is ugly
<FromGitter>
<grkek> I would rather implement a grip application
<FromGitter>
<grkek> and then
<FromGitter>
<grkek> make them define inside the application
<FromGitter>
<grkek> yeah it needs a redesign
<FromGitter>
<halfdan> In my lib (wrapping Hyperscan) I have: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I have a variable `error` of type `Pointer(HsCompileErrorT)`. How do I access message? The compiler crashes when I do `error.value.message`. ... [https://gitter.im/crystal-lang/crystal?at=5e402e88df1153705e252a3a]
<FromGitter>
<grkek> @Blacksmoke16 that makes sense but i need the global pollution lmao
<FromGitter>
<tenebrousedge> @dscottboggs_gitlab how do you feel about using macro magic to snag the proc type?
<FromGitter>
<dscottboggs_gitlab> I thought the whole point of grip was to enclose the macros in classes so that your code would be more well-organized? If you're just `include Grip`-ing in the top level what's the advantage over kemal?
<FromGitter>
<dscottboggs_gitlab> @tenebrousedge not sure what you mean.
<FromGitter>
<Daniel-Worrall> Is there a way to tell what the source address is in kemal or any other http server? I'm looking at the `Response#remote_address` but it's giving me my internal router ip. Not tested it on my remote host yet
<FromGitter>
<dscottboggs_gitlab> @Blacksmoke16 oh come on
<FromGitter>
<tenebrousedge> @dscottboggs_gitlab the type of the proc is known at compile time
<FromGitter>
<dscottboggs_gitlab> wtf is that lol
<FromGitter>
<grkek> @dscottboggs_gitlab Advantage over kemal is that you can turn everything into its own class
<FromGitter>
<grkek> instead of dsl shilling
<FromGitter>
<Blacksmoke16> to be fair you can already do that in kemal iirc
<FromGitter>
<tenebrousedge> @halfdan no, it's because c structs are not the same thing as normal crystal structs
<FromGitter>
<dscottboggs_gitlab> @j8r I didn't know about that and I'm going to archive my library with a link to that issue. Thanks for finding it for me! 😀
<FromGitter>
<tenebrousedge> there's a lot of files on my system named `meow.cr` 😸
* FromGitter
* Daniel-Worrall concern
return0e_ has quit [Ping timeout: 272 seconds]
* FromGitter
* grkek Oh
<FromGitter>
<Daniel-Worrall> Is `HTTP::Request#remote_address` guaranteed to be in format `ip:port` if no middlewares are involved?
<FromGitter>
<tenebrousedge> that's what `HTTP::Server` does
<FromGitter>
<Daniel-Worrall> ye
<FromGitter>
<Daniel-Worrall> it's just mentioning it's not guaranteed to be in that format
<FromGitter>
<Daniel-Worrall> Wondering if that's just a middleware symptom or something I need to handle otherwise
<FromGitter>
<halfdan> Is the crystal compiler self hosted?
<FromGitter>
<Daniel-Worrall> yes
<FromGitter>
<Daniel-Worrall> Okay
<FromGitter>
<Daniel-Worrall> So don't load a 60MB file into an IO::Memory
<FromGitter>
<Daniel-Worrall> It was fine with the 3MB, so I thought... hey why not
<FromGitter>
<dscottboggs_gitlab> why would you do that lol
<FromGitter>
<Daniel-Worrall> To package a file within the binary
<FromGitter>
<dscottboggs_gitlab> Hm? I'm asking why you would load it into memory instead of just using the `File` object itself and streaming it. What's the point in loading a `File` into `IO::Memory` when they are both `IO`?
<FromGitter>
<Daniel-Worrall> In essence, the lib I'm using would handle it normally as a file, or it'd take Bytes/IO:Mem, and I wanted to package the file in the binary with the `read_file` macro
<FromGitter>
<dscottboggs_gitlab> oooh
<FromGitter>
<dscottboggs_gitlab> so what went wrong?
<FromGitter>
<Daniel-Worrall> stack overflow
<FromGitter>
<Daniel-Worrall> and a lot of console spam
<FromGitter>
<dscottboggs_gitlab> oh
<FromGitter>
<dscottboggs_gitlab> you need to put it on the heap instead
<FromGitter>
<Daniel-Worrall> enough to halt my console
<FromGitter>
<Daniel-Worrall> yeah
<FromGitter>
<Daniel-Worrall> I'll just read it as a file
<FromGitter>
<dscottboggs_gitlab> yeah I don't think that can work in a macro :/
<FromGitter>
<Daniel-Worrall> that's fine, it was an effort in laziness tbh
<FromGitter>
<Daniel-Worrall> Less files to manage in shippig
<FromGitter>
<Daniel-Worrall> shipping
<FromGitter>
<dscottboggs_gitlab> fair
<FromGitter>
<Daniel-Worrall> Aww yee, got my GeoIP working
<FromGitter>
<tenebrousedge> PHP is one of the faster scripting languages right now. It's not too far from C performance
return0e has quit [Ping timeout: 240 seconds]
<FromGitter>
<dscottboggs_gitlab> I think I read it makes heavy use of C bindings these days to acheive that.
<FromGitter>
<tenebrousedge> it's a stupid-simple language too, so that helps
<FromGitter>
<ImAHopelessDev_gitlab> nim is #1 in that benchmark because of multithreading right
<FromGitter>
<ImAHopelessDev_gitlab> they have @async syntax, basically mt's your code
<FromGitter>
<dscottboggs_gitlab> go has that too, with different syntax.
<FromGitter>
<dscottboggs_gitlab> green threads and whatnot
<FromGitter>
<ImAHopelessDev_gitlab> nim almost double go's
<FromGitter>
<ImAHopelessDev_gitlab> that's crazy
<FromGitter>
<dscottboggs_gitlab> probably does give it a bump
<FromGitter>
<ImAHopelessDev_gitlab> err. 200 more, not double. didn't see #2
<FromGitter>
<ImAHopelessDev_gitlab> #3
<FromGitter>
<ImAHopelessDev_gitlab> fack benchmarks though, depressing af
<FromGitter>
<dscottboggs_gitlab> in what way?
<FromGitter>
<ImAHopelessDev_gitlab> i am not moving away from crystal cause of this
<FromGitter>
<ImAHopelessDev_gitlab> colossal waste of time and energy to re-write everything
<FromGitter>
<ImAHopelessDev_gitlab> and most importantly, learning a language. why throw it all away. i'm happy with crystal, and i'm happy i moved from javascript
<FromGitter>
<dscottboggs_gitlab> I'd write Crystal over Go any day, even if its twice as fast. The Go router that I've used before (gorilla/mux) is way slower than Kemal and Amber
<FromGitter>
<dscottboggs_gitlab> but I might try Nim because I saw this
<FromGitter>
<dscottboggs_gitlab> and I might try microexpress next time I need to write a webserver for work (I don't even try to bring up languages like Crystal or Nim at work, maybe someday 😅 )
<FromGitter>
<dscottboggs_gitlab> > why throw it all away ⏎ ⏎ what do you mean? You don't lose the ability to write one language because you learned another.
<FromGitter>
<dscottboggs_gitlab> good to see you btw girng it's been awhile
<FromGitter>
<ImAHopelessDev_gitlab> ofc you do
<FromGitter>
<ImAHopelessDev_gitlab> all the time you helped me, and others just all gone
<FromGitter>
<ImAHopelessDev_gitlab> doesn't make sense
<FromGitter>
<dscottboggs_gitlab> well, it's not gone, it's just dusty. If you went back to JS it would take you less time to learn it this time around.
<FromGitter>
<dscottboggs_gitlab> I just kept switching back and forth a bunch of times and eventually I got more than one to click at once.
<FromGitter>
<ImAHopelessDev_gitlab> the reason i switched from js to crystal cause of the websockets benchmarks and just fed up with async/callback hell. now, if i see benchmarks of javascript above crystal it's depressing af. but to be fair to myself, that benchmark seems a little fishy, cause the websocket benchmark i saw from sdrol, blew js out of the water. ⏎ ⏎ i don't know why i find looking at benchmarks depressing, but
<FromGitter>
... i do. i don't like that urge or feeling to learn a new language. in fact, i'm quite sick of it. because it means i have to re-write my gameserver/hobby projects all over again, which is a waste of time. now.. if it's for a job or a new project, or just wanting to learn a new language, then yeah i could see it as being fun
<FromGitter>
<Blacksmoke16> benchmarks dont really mean much
<FromGitter>
<Blacksmoke16> as they arent testing actual applications, plus the chances of needing 800k requests/sec is quite low
<FromGitter>
<j8r> a language it is not all about performance, other aspect are equally or even more important
<FromGitter>
<dscottboggs_gitlab> > other aspects are equally or even more important ⏎ ⏎ ☝️
<FromGitter>
<tenebrousedge> assembly language is super fast, yet for some reason people don't write many applications in asm
<FromGitter>
<j8r> at the end, for micro services, performance/memory consumption are mainly to reduce costs, by having to scale later on
<FromGitter>
<j8r> @tenebrousedge haha right 👍
<FromGitter>
<ImAHopelessDev_gitlab> i become emotionally attached to languages. just like how some people feel funny if they mispronounce a word out loud for the first time. or, how some people are introverts and just not social. ⏎ now, these concepts/abstractions don't really exist in a programming language since its *code* and not a speaking language, however, the level of emotional attachment is still there. just in different
<FromGitter>
... ways
<FromGitter>
<j8r> and we have to be very very good to write fast ASM
<FromGitter>
<ImAHopelessDev_gitlab> thus, learning / re-writing a project with a new language feels very daunting and emotionally draining. not something i want to put myself through. now, if it's for a new project, or just for fun, then yeah i'll give it a try
<FromGitter>
<Blacksmoke16> rewriting is the fun part :p
<FromGitter>
<Blacksmoke16> usually results in better implementation as you can apply your learnings from the initial implementation
<FromGitter>
<ImAHopelessDev_gitlab> that happened a couple times when i re-wrote some functions from js to crystal
<FromGitter>
<Blacksmoke16> the harder part of learning a language isnt the syntax. its more so learning the best practices/features
<FromGitter>
<ImAHopelessDev_gitlab> now that i think of it, i've looked back at some code from when i first started crystal and changed some up cause it was weird. one example was i was doing `Random.new.rand` i nstead of just rand
<FromGitter>
<ImAHopelessDev_gitlab> that's just off the top of my head, there were others much more complex / doing it so bad
<FromGitter>
<Blacksmoke16> to be fair thats still essentially what `rand` doess :S
<FromGitter>
<ImAHopelessDev_gitlab> eh, for me it's the syntax
<FromGitter>
<ImAHopelessDev_gitlab> syntax is the most daunting
<FromGitter>
<ImAHopelessDev_gitlab> look at rust for crying out loud
<FromGitter>
<Blacksmoke16> a bigger issue for you is CSVs and tuples 😉
<FromGitter>
<ImAHopelessDev_gitlab> :D
<FromGitter>
<Blacksmoke16> versus JSON and structs
<FromGitter>
<Blacksmoke16> `.future?` would prob make more sense?
<FromGitter>
<halfdan> Fantastic. I'll dive in tomorrow and see how far I get :)
<FromGitter>
<Daniel-Worrall> probably
return0e has joined #crystal-lang
HumanG33k has joined #crystal-lang
<FromGitter>
<tenebrousedge> okay, whoever is doing a snow dance needs to knock it off >_____<
return0e_ has joined #crystal-lang
return0e_ has quit [Client Quit]
<FromGitter>
<eliasjpr> I have been trying to run a program como liked with docker crystal alpine image and I keep getting an error about I need glibc 2.29. Can anyone help me figure this out?
<FromGitter>
<eliasjpr> Compiled*
<FromGitter>
<eliasjpr> I have been trying to run a program compiled with docker crystal alpine image and I keep getting an error about I need glibc 2.29. Can anyone help me figure this out?
<FromGitter>
<Blacksmoke16> whats the command you're running
<FromGitter>
<eliasjpr> Shards build target
<FromGitter>
<eliasjpr> Inside docker
<FromGitter>
<eliasjpr> With —production flag
<FromGitter>
<eliasjpr> The local machine is ubuntu 19.19
<FromGitter>
<eliasjpr> 1) 10
<FromGitter>
<Blacksmoke16> using the official crystal image?
<FromGitter>
<eliasjpr> Yes
<FromGitter>
<eliasjpr> Latest and alpine versions
<FromGitter>
<eliasjpr> I might have to upgrade my docker version
<FromGitter>
<Blacksmoke16> hm
<FromGitter>
<eliasjpr> Since I think have the apt package version
return0e has quit []
return0e_ has joined #crystal-lang
<FromGitter>
<eliasjpr> I think that shouldn’t matter
<FromGitter>
<Blacksmoke16> can you share the command/error?
ur5us has joined #crystal-lang
ur5us has quit [Read error: Connection reset by peer]
<FromGitter>
<dscottboggs_gitlab> I use `crystal build --static` and `jrei/crystal-alpine` image when building statically
<FromGitter>
<Blacksmoke16> `shards build --production --static --no-debug` works fine for me
<FromGitter>
<Blacksmoke16> with the official image
<FromGitter>
<Daniel-Worrall> I use `docker run --rm -it -v $(pwd):/app -w /app jrei/crystal-alpine:0.32.1 crystal build --static --release src/app.cr`