<FromGitter>
<bararchy> @codenoid The different between threads, processes and Fibers is vast, trying to spawn above 50-100 processes is absurd , it uses alot of resources and it makes sense you got to Out of memory
<FromGitter>
<bararchy> please, use spawn
<FromGitter>
<bararchy> or fork only if you know you should
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<codenoid> but i just run it for 1 time (1 process)
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
<FromGitter>
<bararchy> Hm.... It seems you got 2 errors, EOF = try to read a file (or socket) while the socket was closed (EOF) ⏎ and the 2nd one just means you got non memory to create a new Process
claudiuinberlin has joined #crystal-lang
<crystal-gh>
[crystal] akzhan opened pull request #5000: use Crystal::Hasher and openaddressing in StringPool (master...stringpool-openaddressing) https://git.io/v5bsD
<FromGitter>
<bew> what kind of errors do you get?
adam_ is now known as adam12
<FromGitter>
<papilip> Hi all, I am pleased to announce my first program with Crystal : ⏎ helptransl8 => https://github.com/papilip/helptransl8 ⏎ Return welcome
<FromGitter>
<sdogruyol> @papilip welcome, and congrats on your first Crystal shard 🎉
LastWhisper____ has joined #crystal-lang
<FromGitter>
<ziprandom> @bew I get Invalid memory access, this is the most simple example I have. It's probably a mixture of not understanding libgit2's api and c in general https://pastebin.com/mUdihx62
<FromGitter>
<ziprandom> @bew, there was a regression, this is the snippet that illustrates the problem: https://pastebin.com/wfwENJ8C
<FromGitter>
<bew> @ziprandom what are you trying to do with this snippet?
<FromGitter>
<bew> I got it crashing, then I added the file "test.txt" (as stated in the code), and it printed `strings[0] # => "\u0000\u0000\u0000\u0000\x90`
bjmllr has left #crystal-lang ["WeeChat 1.0.1"]
<FromGitter>
<papilip> @sdogruyol many thanks
<FromGitter>
<ziprandom> @bew sorry, the example had flaws like the hardcoded file name. I'm trying to use the shard (and the bindings) to list all files in the repo and get their contents.
<FromGitter>
<ziprandom> what it prints doesn't reflect the actuall content of the file ..
<FromGitter>
<bew> for my .gitignore I get a size of 140411259312188... there is sth wrong somewhere...
<FromGitter>
<krypton97> is it a bad practice to call c code through stdout?
<FromGitter>
<bew> Oo what do you mean?
<FromGitter>
<krypton97> spawn a process, execute a c binary and collect the output
<FromGitter>
<krypton97> to be used within another language
<FromGitter>
<bew> I don't like it, because in most cases you need to parse the output you get, and I feel it's not as clean as it could be, but that my OCD playing here. Generally I don't think that's a bad practice for simple things
<FromGitter>
<krypton97> I don't like it eaither, but it's blazing fast
<FromGitter>
<ziprandom> @bew `blob_rawcontent` might be more promising, but I don't know how to interpret ` Void*` as a string ...
<linuksz>
what methods should i define for Position?
<Papierkorb>
#< and #succ
<linuksz>
but how can i define succ, when initialize requires two arguments
<Papierkorb>
mh? You return a new position from that.
<Papierkorb>
If there is no sane way of doing that, then there's no sane way to #each over that range in any case.
<linuksz>
but how can succ know when @x should be incremented or @y?
<Papierkorb>
It doesn't. If you can't know, then #succ and thus #each doesn't make sense.
<linuksz>
so it is not possible, is it?
<Papierkorb>
if you can't find a reasonable way for it, no
<linuksz>
ok, i will try to find another solution
<RX14>
ranges are meant for 1d
<FromGitter>
<bew> @ziprandom oh ok, didn't know it wasn't complete. To interpret a `Void*` as string, you can cast it to `UInt8*` then build a String from it `String.new(ptr)`, or if you know the size `String.new(ptr, size)` I think.
<RX14>
perhaps a better design could be found that allows 2d but...
<RX14>
i dont think its worth it
<FromGitter>
<bew> @ziprandom but it feels weird that you get a Void* and not a UInt8*
<FromGitter>
<ziprandom> @bew, thxx. I guess the problem is that I don't fully understand the api ..
<Papierkorb>
RX14: Let's allow to override operator `..` *hides*
<RX14>
noooo
<RX14>
not C++cr
<Papierkorb>
But .. overloading || is hilarious?
<FromGitter>
<bew> @ziprandom did you tried to follow some C tutorial with the raw bindings?
<FromGitter>
<ziprandom> @bew yeah I looked into other, more complete library wrappers in other languages
<oprypin>
linuksz, initialization through calling other methods is not detected
<linuksz>
oprypin, why?
<oprypin>
i dunno, it's difficult
<linuksz>
will it ever implemented?
<oprypin>
i give about 20% likelihood
<oprypin>
(i'm just an outsider taking a guess though)
<FromGitter>
<jsilverMDX> the context doesnt contain anything that will help
<FromGitter>
<jsilverMDX> really dont wanna install nginx
<FromGitter>
<ezrast> @linuksz It's so the compiler doesn't have to do a bunch of code flow analysis to figure out if variables are initialized
<linuksz>
so what can i do?
<FromGitter>
<ezrast> stupid example, https://play.crystal-lang.org/#/r/2qzf always gets initialized (or overflows the stack) but having the compiler figure that out isn't worth the effort and CPU cycles
<FromGitter>
<ezrast> just give everything a default value and then call your other method
<linuksz>
But it is difficult when it is a custom class
<FromGitter>
<ezrast> not sure what you mean by a custom class
<linuksz>
e.g. a window
<linuksz>
a termbox window
<linuksz>
it gets initialized in a separate method
<linuksz>
and the variable can't get a default value, because Termbox::Window.new sets low level terminal flags
<FromGitter>
<ezrast> can you have that separate method return the window object? then just do `@window = make_window_method` in your constructor?
<linuksz>
def make_window_method
<linuksz>
@window = Window.new
<linuksz>
end
<linuksz>
so it directly sets the variable, not only return
<FromGitter>
<bew> I think it's better design to return, without setting the instance variable
<FromGitter>
<ino76> hi .. does anybody know some easy algorithm to show "speed" through languages? PS: btw did you try Nim lang? What do you guys think about it compared to Crystal?
<FromGitter>
<ezrast> Depends, `make_window_method` could be a public method setting a private attribute
<FromGitter>
<ezrast> Never mind, that doesn't make sense
<Papierkorb>
ino76, "show speed through languages"?
<FromGitter>
<bew> True @ezrast , but in this case you'd probably want to have a private method that builds the window, and return it. And this could be transparently be used without side effects in a setter or the constructor
<FromGitter>
<ino76> @FromIRC :) .. somethink like this >> http://benchmarksgame.alioth.debian.org But because I am not so skilled in programming, I need some not so hard algorithms. And why? Because it is fun to measure it a try to progam in different languages.
<Papierkorb>
ino76, All of these algorithms are micro benchmarks. You shouldn't base your opinion of a language solely on their execution speed at all. But you can implement them as check how the language feels of course.
<Papierkorb>
ino76, Though really, for that you don't need to know some specific algorithm. Set a goal, like "implement a webpage offering a really simple REST-based calculator". And then set out and implement it in all languages you want to try.
<Papierkorb>
After that, you can compare the results. If a language is really "fast", but is awful to write, what gives?
<FromGitter>
<ino76> thats exactly what I meant .. speed comparison is just for fun, but implementing some proglem in different languages is a good lesson. Thx for advice.
<Yxhuvud>
hmm, is it normal to get " /var/cache/omnibus/src/llvm/llvm-3.8.1.src/lib/CodeGen/LexicalScopes.cpp:160: llvm::LexicalScope* llvm::LexicalScopes::getOrCreateRegularScope(const llvm::DILocalScope*): Assertion `cast<DISubprogram>(Scope)->describes(MF->getFunction())' failed. " when building with releaseflag?
<oprypin>
Yxhuvud, normal in the sense that everyone on Ubuntu gets it
<oprypin>
not normal that this still isnt fixed -___-
<oprypin>
Yxhuvud, use --no-debug
<Yxhuvud>
ok, then I guess I won't report it.
<oprypin>
at least if this is the error i think it is
<Yxhuvud>
seems to have worked.
<oprypin>
dang it, on macos removing a directory with `remove` says permission error
<oprypin>
even Python has a PermissionError on Mac but IsADirectoryError on Linux, sigh
claudiuinberlin has joined #crystal-lang
<Papierkorb>
That sucks.
<Papierkorb>
Can we do better?
<oprypin>
Papierkorb, probably not in a sane way
<oprypin>
maybe check for PermissionError and then see if its' actually a directory but even that is error prone
gokmen has quit [Quit: I'll be back.]
<oprypin>
because deleting a forbidden directory gives PermissionError too
<oprypin>
however it seems like `rm` command line tool actually first checks if it's a directory
<Papierkorb>
It'd be fine I think if rm fails to just check if it's a directory
<Papierkorb>
Should at least reduce the risk of (impossible?) false-positives and race conditions, while offering better error reporting
<oprypin>
i dont understand your point
<Papierkorb>
If the unlink() failed, check if it was a directory afterwards
<ShalokShalom>
Papierkorb: Can i consider your binding as stable now?
<ShalokShalom>
For the Qt Wiki.
<Papierkorb>
I'm not absent from the project, I'm working on something. They're alpha, and should be considered as such at least until the ABI issue in the Crystal compiler is fixed
<oprypin>
but that shouldnt stop u, there are workarounds probably
<Papierkorb>
There are not.
<Papierkorb>
Or at least none I would want to put into bindgen
<oprypin>
-_-
<Papierkorb>
This is a issue that needs to be fixed right where it occurs. I'm pretty sure this would drive people insane who stumble upon it with lesser knowledge of C and stuff
<Papierkorb>
I mean I was baffled at first too, as you can see in there, I assumed an alignment issue at first
<oprypin>
yes but qt is more important than all other bindings so whatever
DTZUZO has quit [Read error: Connection reset by peer]
<oprypin>
nothing wrong, just avoid structs to avoid errors
<oprypin>
pass strings as 2 args
<Papierkorb>
No, that wouldn't solve everything. I have to return a struct when passing a string back from a virtual override
<oprypin>
Papierkorb, haha no, you don't ever have to return anything
<Papierkorb>
Isn't that issue fixed?
<oprypin>
that issue is fixed but it took pretty damn long
<Papierkorb>
Yeah please no hidden return struct
<Papierkorb>
Sure did
<oprypin>
Papierkorb, no, just "out arguments"
<oprypin>
and im pretty sure your issue title could change from "parameters" to "structs" without losing generality
DTZUZU has quit [Ping timeout: 255 seconds]
DTZUZO has quit [Ping timeout: 240 seconds]
<oprypin>
char** result, int* result_size
DTZUZO has joined #crystal-lang
DTZUZU has joined #crystal-lang
<Papierkorb>
Yeah and now for every structure
<Papierkorb>
[_] Sounds like fun
<Papierkorb>
That being said, neither Qt.cr nor bindgen are 'dead'. Not even "dormant but maintained". I wasn't sleeping the past weeks. May take another week though. (I'm offline this weekend, weee)
<oprypin>
Papierkorb, why dont u pass const QChar *QString::constData() to Crystal and let it deal with that?
<oprypin>
instead of converting and (omg) invoking GC alloc
<oprypin>
oh probably because stack gets deleted
<oprypin>
Papierkorb, I found the way that you include a table of all virtual methods in every object really inefficient. why not make the struct global?