<FromGitter>
<picatz> I'd imagine if I wrote a lil blog thing in Crystal I'd just use Kemal.
<FromGitter>
<picatz> Though something like Jekyll is obviously is trying to fit a different problem then I guess the ones I have.
<FromGitter>
<picatz> I'd really love to continue to see Crystal be used for more than just web application stuff. I've toyed with some command line application stuff for example: https://github.com/picatz/argz
<FromGitter>
<picatz> Weirdly, I actually took some of the design from Argz ( which I do plan on continue working on at some point ) and started working on a ruby version: https://github.com/picatz/command_lion
<FromGitter>
<picatz> I'm not quite sure how I'll manage the projects yet. Maybe I'll make command lion both a ruby and crystal command line framework.
<FromGitter>
<picatz> I've at least half certain I can copy the logic I developed in command lion back into crystal, especially since argz gave the starting grounds for command lion.
<FromGitter>
<picatz> I'm still not entirely sure if I've finalize how I want command lion to work, which would probably make it a bit silly trying to translate that over to Crystal again and then have this weird back and forth.
<FromGitter>
<picatz> Then it's like, why stop there and just implement it in a third language?
<FromGitter>
<wwselleck> yeah i think itd be best to focus on one language for that
<FromGitter>
<picatz> For now, I *guess* I'll just stick with Ruby.
<FromGitter>
<picatz> I do like how easy it is to translate my ideas from one to the other though.
<FromGitter>
<picatz> Like, I'm sure I could probably just do some back and forth during development and not be that bothered at all.
<FromGitter>
<picatz> Assuming there was no one using it, basically.
<FromGitter>
<wwselleck> i've never really considered not using a static site generator for my personal website
<FromGitter>
<wwselleck> the big thing is the blog markdown stuff
<FromGitter>
<wwselleck> the problem with using like kemal is that you have to run the server
<FromGitter>
<wwselleck> with a compiled site, I can just put it on x.github.io and have it hosted for free by github
<FromGitter>
<wwselleck> and not be in the business of managing a server
<FromGitter>
<picatz> I guess it depends what you want to do, right?
<FromGitter>
<picatz> And EC2 instance is easy to deploy. Tools like Vagrant and all the devops magic in the world can allow you deploy your kemal server ( or whatever ) without much hassel at all.
<FromGitter>
<picatz> At least, I genuinely enjoy automating and deploying my own stuff. I think kemal makes it really easy, but I can see where you wouldn't want to mess with that stuff.
<FromGitter>
<wwselleck> yeah it might be a good learning experince...
<FromGitter>
<wwselleck> deploying is one thing i have little experience in
<FromGitter>
<picatz> It's genuinely not hard to do, and in every aspect free.
<FromGitter>
<picatz> You can start small and then roll out your deployments in more elaborate ways.
<FromGitter>
<picatz> Like, start with shell scripts, mess around with tools like puppet or chef.
<FromGitter>
<picatz> InSpec for making sure it is actually configured that way that it is.
<FromGitter>
<picatz> Like, auditing, automating, orchestrating, all the fun words. It's super accessible in my experience.
<FromGitter>
<picatz> And there's all these super helpful guides you can find by *just google'n*
<FromGitter>
<picatz> Or youtube videos *for days*
<FromGitter>
<wwselleck> i think im gonna give a go at a static site gen, if for nothing else to contribute something to the community while learning
<FromGitter>
<wwselleck> is Argz in a usable state?
<FromGitter>
<wwselleck> i might use it myself
<FromGitter>
<picatz> I can run things
<FromGitter>
<picatz> It probably needs some touch ups.
<FromGitter>
<wwselleck> I'd be happy to contribute, I'm just trying to get into the crystal community in any way
<FromGitter>
<wwselleck> ive been jumping arund between different new languages and have definitely settled here
<FromGitter>
<picatz> Feel free to man!
<FromGitter>
<picatz> Like, I'm sure it needs the help.
<FromGitter>
<picatz> command_lion can give some clues as to what I'm going to end up going for with argz
<FromGitter>
<picatz> for one thing, argz things of flags as strings that start with `-` or `--`
<FromGitter>
<picatz> Which I don't enforce in command_lion
<FromGitter>
<picatz> There's also some other cases in argz where I'm not being consistent with command lion and can't think of.
<FromGitter>
<picatz> I'd like to add `:file` type I'd think
<FromGitter>
<picatz> That way I can have a nice little wrapper for when users are working with files perhaps.
<FromGitter>
<picatz> It'd be an opt-in thing, where they could just use `:string` and then open the file.
<FromGitter>
<picatz> But, I'd like for a `:file` type to have some sort of builtin helper method to abort if the file doesn't exist or something maybe.
<FromGitter>
<picatz> Basically a `do` can be a `{` and a `end` can be a `}`.
<FromGitter>
<picatz> So, my understand is, basically nothing.
<FromGitter>
<Fanna1119> @picatz ahh thank you :), coming from a non ruby background. i am still in the phase where i don't what works and what doesn't as well as not sure what is the "right" way of doing some things just yet haha
<FromGitter>
<picatz> No worries 👍
<FromGitter>
<picatz> I don't mind helping out, at least as much as I can 😂
<FromGitter>
<Fanna1119> when you use a c binding in crystal and compile your crystal file, is the c library included into the compilation ?
<FromGitter>
<ShalokShalom> @picatz somebody here told and link me, that there is actually a difference between {} and do/end
<FromGitter>
<ShalokShalom> Papierkorb: I just read your line "Though I'm currently most interested in Widgets, as they're the definitive source of correct native look n' feel" again and realised, that there is stuff like Kirigami, which provides a native look n`feel standard for QML: https://dot.kde.org/2017/08/02/plasma-rocks-akademy
<FromGitter>
<ShalokShalom> Its a Tier1 as told, so works without any other KDE framework. :)
<Groogy>
@Fanna1119 yes if it is a statically linked library I think it is?
<Groogy>
but if it is a shared library it will onmly contain the code to dynamically link with it
<FromGitter>
<Fanna1119> @FromIRC just to clarify, a shared a library is usually ".so", and statically linked is .o ?
<FromGitter>
<Fanna1119> or do i have it backwards haha
<Groogy>
statically linked is .a on Linux at least
<Groogy>
it's an archive of object(.o) though
<Groogy>
but I am not 100% sure because I haven't tried linking statically with Crystal yet
<FromGitter>
<codenoid> agree
_whitelogger has joined #crystal-lang
<FromGitter>
<schoening> should modules start with an uppercase?
<FromGitter>
<bararchy> It seems that read_timeout and write_timeout does not work for pipes
<FromGitter>
<schoening> @vegai thank you, crystal has it all specified nicely. I was actually trying to ask in the typescript room :p
maxpert has joined #crystal-lang
maxpert has quit [Ping timeout: 264 seconds]
bmcginty has quit [Ping timeout: 255 seconds]
<vegai>
:}
bmcginty has joined #crystal-lang
<FromGitter>
<bararchy> Can I cast an Array(UInt8) to Slice(UInt8) ?
<FromGitter>
<bew> You should be able to do #to_slice on it
<FromGitter>
<bararchy> @bew ⏎ Error in line 3: undefined method 'to_slice' for Array(UInt8)
<Papierkorb>
bew, that never went through lul
<FromGitter>
<bararchy> So... no way I guess right ?
<FromGitter>
<bew> Huh right not defined... Why? Idk
<FromGitter>
<bew> Well, could do `Slice.new(arr.to_unsafe, arr.size)` but it's not pretty..
<FromGitter>
<bararchy> Better then nothing
<FromGitter>
<bararchy> :)
<FromGitter>
<konovod> There was a discussion about it. @asterite said that Slice is supposed to be safe, but `Array.to_slice` isn't safe at all - array can be reallocated after this call, making slice bad. So creating slice should be ugly)
<Papierkorb>
*cough* StaticArray
<FromGitter>
<konovod> for StaticArray there is `to_slice` as it's safe. But their usage is of course limited. Size can't be too big etc
<Groogy>
well Static array isn't safe?
<Papierkorb>
It's .. the opposite of safe
<Groogy>
It can't reallocate but it is way more prone to be destroyed in comparison
<FromGitter>
<bew> @bararchy what did you tried that failed for #4891 ?
<FromGitter>
<bararchy> Get a process output via a IO::Memory, as in ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ This wont print anything from process to the output, I played with a different processes also, IO#pipe works [https://gitter.im/crystal-lang/crystal?at=59a3fbb0162adb6d2e40a9d8]
<FromGitter>
<bararchy> I think It can't work because the Process needs an actual FD which IO::Memory is not
<FromGitter>
<bararchy> @bew
<Papierkorb>
Correct
<FromGitter>
<bararchy> In that case, It should not compile and give an error that IO::Memory cannot be used with Process (no overload of...)
<FromGitter>
<bew> right.. it's weird because there should be a copy from the process output, to the memory io..
<FromGitter>
<bew> even looking at the code I can't understand why it's not working, can't fond what I'm missing here..
<Papierkorb>
It has no file descriptor.
<FromGitter>
<bararchy> @bew The process needs an actual FD to write output to, it can't write to the Crystal memory buffer as it's not aware of it's existese
<FromGitter>
<bararchy> You can create a dummy FD that is piped to the IO::Memory, but then it's no longer IO::Memory , it's IO#pipe
<vegai>
there's no way to make operators take optional arguments, is there?
<Papierkorb>
Thankfully not.
<vegai>
:)
<FromGitter>
<konovod> > It's .. the opposite of safe ⏎ ⏎ why? I thought local variables are GC'd anyway, so if there is a Slice pointing to it it won't be gone.
<vegai>
I'm having this problem where I'm defining / for my type, and it might be benificial to have the max precision of the operation be an optional parameter
<Papierkorb>
konovod, StaticArray lives on the stack. The GC never sees it.
<FromGitter>
<bew> @bararchy maybe your example fails because you're not waiting for the process to finish executing, so you don't have any output yet?
<FromGitter>
<marin117> is there any better way than properties and referencing object
<FromGitter>
<cevarief> > can you try with `/bin/ls` ? ⏎ when using parameter, the output does not show. "ls -alh"
<crystal-gh>
[crystal] ysbaddaden opened pull request #4894: Merge SecureRandom into Random and Random::System (master...std-merge-secure-random-into-random) https://git.io/v5GtY
<crystal-gh>
[crystal] ysbaddaden closed pull request #4847: Don't show compiler bug message on invalid target machine (master...feature/bugfix/unsupported-arch-error) https://git.io/v7hNF
<crystal-gh>
[crystal] MakeNowJust opened pull request #4895: Correctly parse '->foo=' (ProcPointer with '=' suffixed method) (master...fix/crystal/parse-name-eq-proc-pointer) https://git.io/v5Gtd
<FromGitter>
<sdogruyol> ugh
<FromGitter>
<sdogruyol> doesnt shards init app something creates a folder named something with shard.yml inside?
<crystal-gh>
[crystal] ysbaddaden pushed 1 new commit to master: https://git.io/v5Gmc
<crystal-gh>
crystal/master fcce0c2 Luis Lavena: Normalize Flate's block interface to `.open`...
<FromGitter>
<bew> @marin117 the class name must start with an uppercase lettre
<FromGitter>
<sdogruyol> so shards init and crystal init is different :/
<FromGitter>
<krypton97> either way, I like how light is the crystal version comparing to the go one
<FromGitter>
<krypton97> nvm, now I got 0.002s for golang version
<Papierkorb>
Yeah I know which lang I'd choose of those two if the only point of difference would be those exact two snippets
<FromGitter>
<krypton97> well, the go version is used in production by the playlyfe guys, the crystal version is kinda new-ish
<FromGitter>
<bararchy> Never used GO, WTH is this: `{}{}`
<Papierkorb>
Sure, however even if there are any showstopper bugs in the Crystal version, its API wouldn't change (much) by fixing them
<Papierkorb>
bararchy, my guess is `interface{}` is an anonymous interface type (in Go, that's "any type goes"), and the following {} could be anything, possibly an empty body for the anon interface we just defined (?)
<FromGitter>
<bararchy> Also, what is `:=` is it like `||=` ?
<Papierkorb>
That syntax was also used by Pascal dialects, possibly others
<Groogy>
yeah it is often used in faux code
<Papierkorb>
At least then it was meant to hinder you from missing an equal sign in a condition
<FromGitter>
<krypton97> map[string]interface{}{} means a map that takes string keys with interface{} value
<FromGitter>
<krypton97> := seems better to me for assignment
<FromGitter>
<bararchy> it does ? it's an extra char
<FromGitter>
<krypton97> but there won't be confusion
<FromGitter>
<krypton97> and := is used for declaration and assignment
<FromGitter>
<krypton97> not only for assignment
<Groogy>
If your performance in coding stuff is affected by an extra char
<Groogy>
then I donnu
<FromGitter>
<krypton97> Maybe I got used this way
<FromGitter>
<kazzkiq> Go shines in terms of performance and compiling speed, but we do have to agree its syntax seems kinda frankenstein sometimes
<FromGitter>
<krypton97> I've tried working with postgres go today. It felt like even c++ could do it easier lol
<FromGitter>
<bararchy> I'm really looking for an excuse to try the Crystal QT5 lib
<FromGitter>
<krypton97> if you wanna use it in production, you need to get a license
<FromGitter>
<bararchy> really ??
<FromGitter>
<bararchy> even for OpenSource projects ?
<Papierkorb>
Not at all
<FromGitter>
<krypton97> That's qt as far as I know
<Papierkorb>
NO NO NO NO
<FromGitter>
<krypton97> Open source is free
<Papierkorb>
Heck no
<FromGitter>
<krypton97> but for comercial nope
<Papierkorb>
krypton97, you're wrong
<FromGitter>
<krypton97> Qt free for comercial user, I dont think so
<FromGitter>
<krypton97> use*
<Papierkorb>
Yeah no I was years in #Qt, and talked to the maintainers time and again about this
<Papierkorb>
I think I know what's ok wrt LGPL and what's not
<FromGitter>
<krypton97> If you make your code public you can use it for comercial use, but that makes no sense
<Papierkorb>
Dude no.
<Papierkorb>
Please read the LGPL.
<FromGitter>
<krypton97> wth man, qt is not free if you wanna make money with it
<FromGitter>
<krypton97> If so, why would they sell license keys??
<Papierkorb>
bararchy, Qt is dual-licensed: 1) LGPL 2) Commercial license. You can choose freely among these. You can absolutely create a closed source product (and also sell it). The kicker is this: The LGPL requires you that the end-user can change the LGPL'libraries
<Papierkorb>
LGPL'd library in use, e.g., to a patched one, of their choosing
<Papierkorb>
This means in practice that you bind dynamically to Qt, and then distribute the dynamic libraries with your product.
<Papierkorb>
You must not however statically bind to Qt and then ship it closed-source: If you want to do this, you have to acquire a commercial license, which does allow this
<FromGitter>
<krypton97> Knew about dinamically linking, either way I'm not that much into it
<FromGitter>
<bararchy> Oh, so it's only the QT libs I need to keep dynamic linked, not that bad, it's pretty standrd too, why would I want to static compile against QT
<FromGitter>
<krypton97> Don't mind if I seemed to be a little rude..
<Papierkorb>
bararchy, yeah that's what we said in #Qt too: "Why would you?". There are reasons, and some developers simply prefer a (in their view) "proper" commercial license. Which is perfectly fine, I don't want to argue against it. Though for most developers, the LGPL won't be much of an issue at all.
<Papierkorb>
Even if you do decide on a commercial license (Which has other benefits over the effective linking restriction!), it's not that expensive anymore like it used to.
<Papierkorb>
Regarding Qt, there are actually quite some pitfalls of doing so: At least on Windows, a EXE can't export symbols (like ELF can on linux). Hence, if you link statically, you won't be able to load Qt plugins (for loading pictures, ..) dynamically anymore. Only static plugins. Which is why many manufacturers choose a commercial license, but link dynamically either way. A strong plus for going this route is that you're allowed to change Qt
<Papierkorb>
sources, without having to share them (Like you would have to under the LGPL)
<Groogy>
Yeah I mean I use Qt at work
<Papierkorb>
So, in short, the LGPL is fine and neither Qt itself, nor qt5.cr's license, itself keep you from selling your closed-source products.
<Groogy>
not the libs though, just the maker
<Papierkorb>
QtCreator is fantastic <3
<Groogy>
ages ago it got looked into but our legal team said "This is fine"
<Groogy>
and I mean we have licences for Sublime
<Groogy>
not because need to but because it's nice to have
mark_66 has quit [Remote host closed the connection]
<Papierkorb>
bararchy, What project did you have in mind? Or just toying with it?
<Papierkorb>
I ran a crude search yesterday, and it appears that currently, about 13% of all classes from Core, Gui and Widgets modules are wrapped. Many types don't require any special handling at all, adding the class and its enums usually makes them work
maxpert has joined #crystal-lang
<FromGitter>
<bararchy> Papierkorb I guess I'll try to add a GUI to my ssl-scanner https://github.com/bararchy/sslscanner/ ⏎ Then if that goes smothly I'll try to bind something to one of my closed-source ideas
<FromGitter>
<bararchy> I'll give you credit in both cases :)
<FromGitter>
<mverzilli> I'm not 100% sure of this, but the fact that Tuples are structs, and structs are stored in the stack, would make it impossible to create recursive tuples
<jokke>
oh i see
<jokke>
good point!
<jokke>
hm no that didn't help either
<watzon>
Wondering why `String.bytes` returns an `Array(UInt8)` when `Bytes` is an alias for `Slice(UInt8)`
<FromGitter>
<johnjansen> @watzon you are not the first to wonder … if only i could recall the answer
<watzon>
It just seems very inconsistent to me
<FromGitter>
<johnjansen> yeah, there was a logical answer though from memory
<watzon>
So what's the best way to turn a String into a Slice of Bytes rather than an Array?
<FromGitter>
<krypton97> I think I saw the author on gitter few days ago
franzejr has quit [Ping timeout: 260 seconds]
alex`` has quit [Ping timeout: 255 seconds]
maxpert has joined #crystal-lang
maxpert has quit [Ping timeout: 248 seconds]
<FromGitter>
<matrixbot> `@Renich:matrix.org` o/
<oprypin>
no, just no.
<FromGitter>
<jwaldrip> hey @krypton97, that was a work in progress some time ago.
<FromGitter>
<jwaldrip> Had a kid, and things halted for a bit. Should be picking up development again soon. Its a direct port of the fb/graphql js parser.
<FromGitter>
<jwaldrip> and all in crystal, no C binding.
<FromGitter>
<krypton97> No worries man, having kids is one of the best things. I was also thinking to port a go version
<FromGitter>
<krypton97> But for now I'm reading through the source codes of the crystal implementations
<FromGitter>
<jwaldrip> Don't be too critital, as I said, still much of a work in progress
<FromGitter>
<bew> hey guys, any way to make sth like this to work? https://carc.in/#/r/2m16 or is it too demanding to the *broken* generic type inference?
<FromGitter>
<bew> Papierkorb, I've been looking at your cannon RPC (as I'm on the way to make a msgpack RPC lib too), I think you have some type annotations you can remove here and there
hightower2 has joined #crystal-lang
<Papierkorb>
bew, do they disallow something that would make sense otherwise? I often use explicit typing for clarity to the reader, and to the compiler (for it to generate better errors)
<FromGitter>
<bew> no it's perfectly fine, just some 'obvious' ones, like `@owned : Bool = false` for example
<FromGitter>
<bitmappergit> in crystal does it matter if i have a single string on multiple lines?
<Papierkorb>
bew, well ok *that* is a bit redundant I guess.
<Papierkorb>
bew, truth be told, you should consider if you actually want to implement such a heavy-weight RPC library, or if a simpler design suffices
<FromGitter>
<bew> I do, because I have no choice in this case, this is how nvim does communication between in its plugin system, and I reaaally want to write nvim plugins in crystal :p
<Papierkorb>
The Cannon RPC stuff is explicitly for "dude I got other things to do, make it work now". Pretty much the human-pendant to Cannons slogan itself ("The computer has other things to do than serialisation"). This makes it quite powerful, and also makes it offer some unique features (Which I only offer 'cause Cannon RPC is for organisation-internal use ONLY) like remote object ownership. But it also makes it quite complex
<FromGitter>
<elorest> Nice. should I stick with nvim. A couple issue are really making me want to switch back?
<FromGitter>
<bew> Papierkorb, I understand that, and you did a great job at simplifying the process of rpc for flexibiliy & speed!
<FromGitter>
<elorest> Relative line numbers are super laggy. There’s no :X encryption option and it doesn’t reload file changes for open files.
<FromGitter>
<bew> @elorest what kind of issues do you have?
<FromGitter>
<elorest> @bew ^
<Papierkorb>
bew, just wanted to mention that lul. If its architecture helps you decide for msgpack, then that's awesome :)
<FromGitter>
<bew> @elorest I use relative numbers all the time, I've no issue with it personally.. about the 2 others, I don't use them so I can't say
<FromGitter>
<elorest> @bew Weird. For me when I let up `j` it just keeps scrolling for like 2 seconds until it catches up. Same files and plugins from vim.
<FromGitter>
<bew> Papierkorb actually it helped when I was banging my head to find proper names for things ^^, and also on how you wrote your description (I was going directly with macro & stuff when cannon uses simple crystal module and abstract def, pretty simple, it perfect 👍 )
<FromGitter>
<bew> @elorest you mean.. when you keep `j` pressed for a few sec, then release it? 😨
<FromGitter>
<elorest> yeah like if I scroll down 5 lines it keeps going like 6 more.
<FromGitter>
<bew> weird, I just tried in big file, when I release it stops instantly..
<FromGitter>
<elorest> Are you using vim-crystal?
<FromGitter>
<bew> yes
<FromGitter>
<bew> tried in string.cr (in the compiler, 4000~ lines)
<FromGitter>
<elorest> Hmmm. I’m guessing I must have a plugin that works fine in normal vim but makes certain aspects of nvim slow.
<FromGitter>
<elorest> Thanks.
<FromGitter>
<bew> maybe you have some mapping on `j` ? try `:nmap j`
<FromGitter>
<bew> to see if there's a mapping
<FromGitter>
<bew> (normal)
<FromGitter>
<bew> otherwise it could be a good exercise to not press j/k multiple times, and use `4j` to move 4 lines below :p
<FromGitter>
<elorest> yeah I do that usually do that. Although in the case of just 2 or 5 lines I usually just hold j/k since it’s less movement.
<FromGitter>
<elorest> Might have to re-adjust if I can’t fix this.
<FromGitter>
<elorest> `no mapping found`
<FromGitter>
<bew> in any case, it doesn't seems to be a nvim issue, you should try with empty config, to see if it because of one of your plugin
Disrecollection has joined #crystal-lang
sz0 has joined #crystal-lang
<FromGitter>
<bew> @elorest it could be because of a plugin that triggers on CursorMoved hook, e.g a linter, or autocompletion engine (you should use asynchronous linter/completer in nvim like neomake/deoplete, to avoid blocking the UI)