ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.23.1 | Fund Crystal's development: | GH: | Docs: | API: | Gitter:
<FromGitter> <fridgerator> @MrSorcus have you tried using crystal_lib ?
<FromGitter> <MrSorcus> @fridgerator Nope...
<FromGitter> <fridgerator> you can use it to generate bindings for you
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter> <MrSorcus> @fridgerator I know about this shard, but i want to do it by hands...
<FromGitter> <fridgerator> ah
<FromGitter> <bew> It would be something like `fun binn_is_valid(ptr : Void*, type : Int32*, count : Int32*, size : Int32*) : Bool`
<FromGitter> <bew> And for type, count & size you can use `out` syntax to help
<FromGitter> <MrSorcus> > It would be something like `fun binn_is_valid(ptr : Void*, type : Int32*, count : Int32*, size : Int32*) : Bool` ⏎ With this i have no problems. ⏎ > And for type, count & size you can use `out` syntax to help ⏎ Thanks, i will try it. []
<FromGitter> <MrSorcus> @bew Oh, it's so easy. Thank you so much.
<FromGitter> <bew> You're welcome;)
<hightower4> How do I print value of errno? E.g. if I call File.readable?( some_file) and want to see the original error from the syscall
<FromGitter> <bew> I so think errno is set when determining if the file is readable or not, it not an error if the file is not
<FromGitter> <bew> Don't*
txdv has quit [Ping timeout: 240 seconds]
<FromGitter> <faultyserver> anyone know what's up with
txdv has joined #crystal-lang
<FromGitter> <faultyserver> I'm getting a "no such app"
<hightower4> bew right, right. But let's say I ask for .readable? and it gets Permission denied while running a stat() or something. So I'd like to get that error out.
vivus has quit [Quit: Leaving]
shelvacu has quit [*.net *.split]
benner has quit [*.net *.split]
dostoyevsky has quit [*.net *.split]
SuperChickeNES has quit [*.net *.split]
literal has quit [*.net *.split]
fnux has quit [*.net *.split]
saadq_ has quit [Ping timeout: 240 seconds]
maxpowa has quit [Ping timeout: 260 seconds]
saadq has joined #crystal-lang
maxpowa has joined #crystal-lang
<FromGitter> <drosehn> Check how File#file? does it using Errno: ⏎
fnux has joined #crystal-lang
SuperChickeNES has joined #crystal-lang
benner has joined #crystal-lang
shelvacu has joined #crystal-lang
dostoyevsky has joined #crystal-lang
literal has joined #crystal-lang
dostoyevsky has quit [Max SendQ exceeded]
dostoyevsky has joined #crystal-lang
<FromGitter> <drosehn> Note that you have to capture the value of Errno *immediately* after the return from the system routine which failed. If anything you do calls some other system routine, then all bets are off as to what `Errno.value` will have in it.
<FromGitter> <drosehn> Also, you should not check the value of Errno unless the system routine you called did fail. If it succeeded, then you might get the value of Errno from some earlier call to a system routine.
<FromGitter> <codenoid> can i "upload" a file within HTTP::Client with *`multipart/form-data
<FromGitter> <codenoid> (?)
<FromGitter> <codenoid> same @faultyserver
sz0 has joined #crystal-lang
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lacour has quit [Quit: Leaving]
sz0 has quit [Quit: Connection closed for inactivity]
illy_ has quit [Remote host closed the connection]
balduin has quit [Ping timeout: 268 seconds]
balduin has joined #crystal-lang
<FromGitter> <jwaldrip> is 0.24.0 stable. my homebrew did not get the latest
qard has joined #crystal-lang
<FromGitter> <marksiemers> @jwaldrip - it is not. the next stable release will be 0.24.1 AFAIK
<FromGitter> <marksiemers> I don't know the details, but there was a mistake in the release and versioning process, I think
<FromGitter> <jwaldrip> gotcha
<FromGitter> <jwaldrip> gotcha makes sense. Its been quite awhile since they have cut a full release. I hope everything is kosher over at manas. :-/
DTZUZO has quit [Ping timeout: 248 seconds]
<FromGitter> <jwaldrip> Also hope we can still look forward to a 1.0 release near the first of the year as they stated last year.
<FromGitter> <marksiemers> @faustinoaq - I see you created the vscode-crystal-lang extension. ⏎ Is that how you got the debugging tools to work, or is there something else that did that?
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Groogy> Morning! o/
claudiuinberlin has joined #crystal-lang
mark_66 has joined #crystal-lang
flaviodesousa has joined #crystal-lang
Papierkorb_ has joined #crystal-lang
hightower2 has joined #crystal-lang
<FromGitter> <Rinkana> Morning :)
<FromGitter> <bew> Morning \o
<FromGitter> <sdogruyol> morning everyone
<faustinoaq> @marksiemers, no, debugging tools works using native-debug extension
<faustinoaq> There is a couple of useful extensions for crystal on VSCode see:
<faustinoaq> Actually vscode-crystal-lang just support these features
<faustinoaq> That we want to implement using Scry
<faustinoaq> To be able to share full language support with Atom, VSCode, Vim/NVIM, Sublime, Eclipse and so on
<faustinoaq> BTW, VSCode and Atom announced yesterday excellent features:
<faustinoaq> :)
p0p0pr37_ has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
<faustinoaq> Morning :)
p0p0pr37 has quit [Ping timeout: 255 seconds]
p0p0pr37_ is now known as p0p0pr37
<Groogy> I need to lookinto configuring my vscode more
<Groogy> haven't tried debugging with it yet xD
<Groogy> I've been doing more oldschool logging debugging
<Papierkorb_> ... can I remove that teletype atom extension?
<FromGitter> <sdogruyol> what? It's not installed by default
<faustinoaq> Looks like is failing I found :)
<FromGitter> <sdogruyol> oh lol
<FromGitter> <sdogruyol> let me reach the author
<FromGitter> <sdogruyol> but nvm, he's busy being a father atm
<faustinoaq> no problem :wink:
txdv has quit [Ping timeout: 255 seconds]
<FromGitter> <codenoid> wow, 5 bomb from @veelenga on recently updated crystal repo,
<FromGitter> <sdogruyol> @marksiemers I don't think this is fair in a normal setup
<Papierkorb_> might as well hard-code the serialized JSON body
<FromGitter> <sdogruyol> lol
<faustinoaq> ‎Papierkorb_, Oh, What do you mean?, maybe we can have more RPS here
gewo has quit [Quit: WeeChat 1.6]
gewo has joined #crystal-lang
<Papierkorb_> `%<{"message":"Hello, World!"}>` Do note that I'm on the same page as sdogruyol, this is a hack that shouldn't be done at all.
<Papierkorb_> Except if you're benching amber routing overhead, which is probably easier to do within a single process to cut out network overhead
<faustinoaq> Ok +1
claudiuinberlin has quit [Quit: Textual IRC Client:]
claudiuinberlin has joined #crystal-lang
<FromGitter> <sdogruyol> agree
<FromGitter> <sdogruyol> hey @faustinoaq this might interest you
<faustinoaq> Yeah, +1
<FromGitter> <ziprandom> hey @sdogruyol I'm trying to implement an api wrapper with kemal that proxies requests to another api. basically feeding the request made to the server into HTTP::Client like this: works nice for get but breaks for post: "Content-Length header is 1526 but body had 0 bytes (ArgumentError)"
<FromGitter> <sdogruyol> hmm I remember an issue like that
<FromGitter> <sdogruyol> have you tried Kemal master?
<FromGitter> <sdogruyol> (meanwhile pastebin is blocked here..)
<FromGitter> <sdogruyol> can you share a gist instead?
<FromGitter> <ziprandom> hmm, no because if incompatibilities
<FromGitter> <ziprandom> using crystal 0.23.1
<FromGitter> <ziprandom> kemal master uses 0.24 already, no?
<FromGitter> <sdogruyol> yes
<FromGitter> <sdogruyol> have you seen this issue
<FromGitter> <sdogruyol> this is probably fixed in master
<FromGitter> <ziprandom> ok, trying the commit
<FromGitter> <ziprandom> yeah still get the same error
<Papierkorb_> ah you already rehosted, didn't see that ziprandom
<FromGitter> <ziprandom> the content type of the request I'm forwarding from Kemal handler to HTTP::CLIENT is application/x-www-form-urlencoded
<FromGitter> <ziprandom> seems the body is not set correctly for req ...
rohitpaulk has joined #crystal-lang
Bish has quit [Ping timeout: 248 seconds]
Bish has joined #crystal-lang
claudiuinberlin has quit [Max SendQ exceeded]
<FromGitter> <extremety1989> hey guys, has someone a repo with postgres db crud exemple ? i found some, but they are outdated..
hightower2 has quit [Ping timeout: 240 seconds]
sz0 has joined #crystal-lang
<FromGitter> <bararchy> If someone is interested, my company is hireing Crystal devs, we just posted the jobs in the google group :)
<FromGitter> <bew> oh niice!!
<FromGitter> <sdogruyol> great 👍
<Yxhuvud> nice, but you may want to include where you are in the world next time :)
<FromGitter> <jwaldrip> @sdogruyol is fine too ;-)
<FromGitter> <sdogruyol> the heroku app is down
<FromGitter> <jwaldrip> In fact, if he just wants to point DNS there. I think one copy is fine...
<FromGitter> <jwaldrip> For yes.
<FromGitter> <jwaldrip> .org is up
<FromGitter> <jwaldrip> (and is not on heroku)
<FromGitter> <sdogruyol> oh sorry, I misread it :P
<FromGitter> <bararchy> Yxhuvud we are accepting remote position, we are based in Israel, but it shouldn't matter as you can work from home
<Groogy> huh wut?
<Yxhuvud> in any case, that should be mentioned in the ad..
<sevensidedmarble> hey Papierkorb if I use your in another project do I need to reproduce your license in my license file?
<FromGitter> <bararchy> Yxhuvud True, will add in the group, and future posting
<Papierkorb_> sevensidedmarble:
<Papierkorb_> and the sector too. due to its nature that information is critical.
<Papierkorb_> sevensidedmarble: Well, fancyline uses the MPL-2 license. I included the link to tl;drLegal in the README:
<Papierkorb_> Wait what? MPL doesn't protect patent claims?
<Papierkorb_> Looks like I'll have to relicense affected shards. "fun times ahead."
<Papierkorb_> To something equally restrictive (or more restrictive, within reason), but with a "your patents are mine now" clause like modern GPLs do.
<sevensidedmarble> I've never thought about it too indepth
<sevensidedmarble> I always just ust the MIT license
<Papierkorb_> sevensidedmarble: So yeah, um do what the `MUST` block on the right tells you. If you're unsure, just ask again
<Papierkorb_> Man licenses suck
<sevensidedmarble> is including the mpl in my same LICENSE file best practice?
<sevensidedmarble> or is it better to use a seperate file?
hightower2 has joined #crystal-lang
<Papierkorb_> What you usually do if you have multiple licenses in your project is to have a `LICENSE.X` file per license, with X being the short name of the license
<Papierkorb_> like `LICENSE.MIT` and `LICENSE.MPL2`. FOSS projects tend to use COPYING over LICENSE as name prefix, but that makes no difference really
<Papierkorb_> At the end of your README, in your License section, you put what license you use (Didn't the crystal project generator already do that?). You can append a short notice there that the file(s) at `src/foo/` use the MPL-2 license.
<sevensidedmarble> ah alright
<Papierkorb_> Honestly, there's barely a right or wrong on how to do it.
<Papierkorb_> For a part I took from Clang into bindgen, I only needed a single file. So I copied everything into there:
<sevensidedmarble> also yeah the default crystal generator doesnt have a license section for the generated readme
<sevensidedmarble> thanks thats helped a lot
<sevensidedmarble> I've always felt a little intimidated by modifying others source code because of fear of fucking up the license stuff
<Papierkorb_> Don't worry too much. "Best effort basis" is legit, and no sane person will just go out of their way and sue you to oblivion. At worst case, you may get a snarky email.
<Papierkorb_> And even if they want to sue you, they have to in your jurisdiction. If someone would sue me in the US, I couldn't care less: “Wrong continent, buddy.”
<FromGitter> <bararchy> ^this is why patent rules don't really hold up
rohitpaulk has quit [Ping timeout: 255 seconds]
<sevensidedmarble> man I do not not understand nearly enough about macros in crystal
<sevensidedmarble> I dont grok when/why theyre useful at all
<Groogy> I probably overuse them to make my own DSL
<Groogy> for use cases, plus self promotion ^^
<Papierkorb_> They're off-the-charts useful. I hate factory classes, but you do need them. Let crystal write them for you:
hightower2 has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
<Groogy> also if you have been using property, getter, etc.
<Groogy> that's macros
<Groogy> good to make your code more readable instead of copy pasting everywhere
<FromGitter> <extremety1989> can someone make exemple with postgres CRUD ?
<FromGitter> <sdogruyol> @Papierkorb that's some good Crystal macro code
<faustinoaq> Hi, Why crystal don't declaration files like `.h` in C? Aren't declaration files useful for a typed language?
<Papierkorb_> ... huh? Why?
<FromGitter> <sdogruyol> no, they're redundant..
<faustinoaq> s/don't declaration/doesn't have declaration/
<Papierkorb_> header files are really C/++ centric
<Papierkorb_> They're only really useful if your language is split into translation units that can be compiled separately, to allow distribution of these units (aka static/dynamic libs) to be later easily written code for
<Papierkorb_> Without sharing the original source code
<Papierkorb_> Which simply doesn't apply to Crystal, nor Rust, nor ...
<Groogy> Only old languages have header files
<Groogy> it's a remnant from how bad compilers used to be
<Groogy> Not even D has it
<FromGitter> <sdogruyol> not even go
<Papierkorb_> Though I did like it at some point to separate lengthy in-source docs from the implementation
<Groogy> but it can generate it for you if you want to share the library
rohitpaulk has quit [Ping timeout: 248 seconds]
<Groogy> but not the source
<Papierkorb_> docs into the header for API description (Which it does anyway)
<faustinoaq> Oh, Thanks you for your comments, :) I was reading & learning TypeScript and I found they use `.tsd` Declaration files and seems to be useful for a typed language
<sevensidedmarble> why does something like CtrlQ = '\u{11}' result in the error "invalid constant value"?
_whitelogger has joined #crystal-lang
<watzon> If it can hit v1 soon enough
<FromGitter> <claisne> If it does it will be a real testament to the greatness of the language
<FromGitter> <claisne> go is backed by Google
<watzon> That's the thing
<watzon> Crystal is a definite underdog
<sevensidedmarble> also I have this little bit of code thats checking for input
<watzon> Very little financial backing, but a great community
<sevensidedmarble> and it doesnt match char.ord to the value 17 for some reason
<sevensidedmarble> never mind I'm stupid
<sevensidedmarble> I didnt know you had to call .value on the enums members
<Groogy> yeah enum is its own type
<FromGitter> <claisne> you can do better @Sevensidedmarble if im not mistaken you can type: when Keys::ctrlQ?
<faustinoaq> ‎Groogy, ‎‎Papierkorb_, @sdogruyol Yep, declaration files are a bit redundant, I tried modules with abstract methods in crystal just for fun :)
<Groogy> I mean I kind of do that for my backend in Boleite
<Groogy> so I can in the future switch between OpenGL, DirectX and Vulkan
<FromGitter> <extremety1989> i read that using structs better than classes
<Groogy> then you read wrong?
<Groogy> they have two vastly different behaviours, if you don't want the behaviour struct gives you, then you don't want structs
<faustinoaq> "So how do you choose between a struct and a class? The rule of thumb is that if no instance variable is ever reassigned, i.e. your type is immutable, you could use a struct, otherwise use a class." ...
<FromGitter> <extremety1989> but i saw the speech in youtube, they sey struct are allocating on stack ,classes on heap
<Groogy> That's how I use it for my Vectors and Matrix classes
<Groogy> yeah and?
<Groogy> that's two different behaviours, not claiming one is better than the other?
<FromGitter> <extremety1989> less memmory overhead
<Groogy> no its still the same memory footprint, just in two different places?
<FromGitter> <extremety1989>
<FromGitter> <extremety1989> he does say that
<Groogy> if he is recommending you to prefer structs you shouldn't listen to him
<Groogy> the only higher overhead is going to be memory allocation, but if you do the same on the stack you are going to get stackoverflow
<Groogy> also if something is on the stack it is going to get copied everywhere, so if the struct is big enough it will mean everytime you use it, it is going to have a significant overhead
<FromGitter> <extremety1989> i just started 2 days ago with crystal, i am javascripter))
<Groogy> that's fine, it's a common mistake people do in other languages as well
<FromGitter> <extremety1989> i just got this repo
<FromGitter> <extremety1989> but i get this error
<FromGitter> <extremety1989> Error in src/ instantiating 'Note:Class#all(DB::Database)' ⏎ ⏎ ``` do |note|``` []
<Papierkorb_> Groogy: The amount of people not understanding what the heap/stack (not) is is too damn high
<Groogy> heh yeah
<Groogy> extreme that error looks sort of as if one of the repositories got updated and another haven't updated to a new thing
<Groogy> or something
<Groogy> if you have the HEAD of both
<FromGitter> <extremety1989> what i hate about crystal libraries, there are few exemples..
<Papierkorb_> Have you checked the docs?
rohitpaulk has joined #crystal-lang
<FromGitter> <extremety1989> yeah,nothing found
<FromGitter> <extremety1989> i just need to find good tutorial with postgres
rohitpaulk has quit [Ping timeout: 248 seconds]
Papierkorb_ has quit [Remote host closed the connection]
greengriminal has joined #crystal-lang
flaviodesousa has quit [Ping timeout: 248 seconds]
mark_66 has quit [Quit: Leaving.]
t-richards has quit [Quit: Connection closed for inactivity]
rohitpaulk has joined #crystal-lang
txdv has joined #crystal-lang
DTZUZO has joined #crystal-lang
qard has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
lacour has joined #crystal-lang
hightower3 has joined #crystal-lang
hightower4 has quit [Ping timeout: 240 seconds]
claisne has joined #crystal-lang
rohitpaulk has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
greengriminal has quit [Quit: This computer has gone to sleep]
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
greengriminal has joined #crystal-lang
claisne has quit [Quit: WeeChat 1.9.1]
<FromGitter> <marksiemers> @sdogruyol - RE: the TFB. You may be right about using the `Fast` pipe. A few points there: ⏎ ⏎ 1) I'm trying to gather info, if that Fast pipe significantly speeds up plaintext (and/or json) on TE's hardware, then (at least for amber) it may mean we consider replacing or augmenting `radix` for routing. ⏎ 2) Using custom pipes is normal for amber, while this particular pipe looks hacky, the overall
<FromGitter> ... approach would be "normal" for an amber app. ⏎ 3) As-is, the fast pipe doesn't actually by-pass radix entirely, amber still uses it to see if it is a "valid" route. Still, in my local testing, we saw a relative performance gain (> 25%). Since we haven't been able to replicate the relative (amber vs crystal-raw) slowness in our ow ... []
rohitpaulk has quit [Ping timeout: 255 seconds]
<FromGitter> <marksiemers> @Papierkorb_ for the JSON serialization and plaintext, that is exactly what those tests are for - known, hardcoded values. There are separate tests for dynamic data and incorporated databases. ⏎ The plaintext and JSON serialization are where we see a huge an unexpected difference between crystal-raw and kemal & amber. ⏎ A difference we can't reproduce, so we're trying to make educated guesses and see
<FromGitter> ... what (if any) difference it makes.
greengriminal has quit [Quit: This computer has gone to sleep]
<faustinoaq> Hi @marksiemers, did you try [native-debug]( extension for VSCode? :)
claudiuinberlin has joined #crystal-lang
greengriminal has joined #crystal-lang
<FromGitter> <akzhan> looks loke development speed greatly decreaseses last two weks
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
faustinoaq has quit [Read error: Connection reset by peer]
faustinoaq has joined #crystal-lang
qard has joined #crystal-lang
<crystal-gh> [crystal] petoem opened pull request #5306: Prevent Time::Span overflow (master...fix-time_span)
<FromGitter> <marksiemers> @faustinoaq - I haven't yet. Just installed VS code last night, and haven't had time to mess with it today.
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qard has joined #crystal-lang
<crystal-gh> [crystal] straight-shoota closed pull request #5229: Improved search feature for API docs (
illyohs has joined #crystal-lang
illyohs has quit [Remote host closed the connection]
illyohs has joined #crystal-lang
<faustinoaq> >> print "@marksiemers no problem :)!"
<DeBot_> faustinoaq: @marksiemers no problem :)! -
<FromGitter> <unreadable> > guys what you think will crystal dominate go or not ?))
<FromGitter> <unreadable> well go is starting to gain more and more popularity
<FromGitter> <unreadable> and it doesn't depend on libc as well
<FromGitter> <unreadable> none of those are solid reasons, but comparing to crystal it's much more mature
claudiuinberlin has quit [Quit: Textual IRC Client:]
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Papierkorb> it not using the libc isn't really important. It's a huge maintenance burden, and if you have any single C lib in your program, then you also need the libc. If that's worth it ..
qard has joined #crystal-lang
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
faustinoaq has quit [Quit: Konversation terminated!]
faustinoaq has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #crystal-lang
greengriminal has quit [Client Quit]