<FromGitter>
<OldhamMade> my current thought is that it's down to the crystal install that's being used in the container, so I'll next look at building crystal manually directly on alpine.
<crystal-gh>
[crystal] akzhan opened pull request #5100: Complex.hash(hasher). (master...complex.hash) https://git.io/vdrcy
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Groogy>
had a discussion yesterday how we could potentially hook up our script language to LLVM.....
<Groogy>
alcohol might have been involved
<FromGitter>
<bew> ahahah nice derivation
<Groogy>
big complaint is no debugging tools and I said this as a "Well we could do this to just get everything for free..."
<Groogy>
and then we got talking about how it would actually work together with modders etc.
<FromGitter>
<bew> you wanted to use llvm for jit? or compilation?
<FromGitter>
<bew> nvm "script"
<FromGitter>
<sdogruyol> @faustinoaq not yet
<Groogy>
compilation, compile it to a shared library and load it at runtime
<FromGitter>
<bew> well there is lldb, but maybe it's not what you're looking for?
<FromGitter>
<bew> ah ok, nice
<Groogy>
we are not actually doing it though xD it would be insane
<Papierkorb_>
Transpiling to Lua I could understand, but LLVM for what's basically a behaviour definition script? wat
<FromGitter>
<bararchy> @OldhamMade ( @sdogruyol ) I too have this issue, but only when compiling in `--release` mode, in regurlar debug mode I can't reproduce
<Groogy>
Papierkorb_ the qualifier of the whole event is "alcohol might or not been involved"
<Papierkorb_>
Groogy: I saw that, I put it into context, and still: Wat
<Groogy>
Our modders do insane things and it would enable them to do more without slugging down the game
<Groogy>
I already have implemented an optimizer that at runtime redoes the script to make it faster while retaining the normal execution
<Groogy>
this would be that but just like.... better
<Papierkorb_>
LuaJIT *cough*
<watzon>
I'm getting a weird error when I try to compile with `--release` that I'm not getting otherwise
<FromGitter>
<bararchy> watzon use `--release --no-debug`
<FromGitter>
<bararchy> this is a kown issue
<watzon>
Gotcha, thanks
claudiuinberlin has joined #crystal-lang
<watzon>
Do you have a link to the issue in github so I can follow it?
<FromGitter>
<bararchy> the "fix" is to ugrade your llvm to 4.0 or above
<FromGitter>
<bararchy> AFAIK
<FromGitter>
<bararchy> latest Crystal droped support for anything <4.0
<Groogy>
no but our script language is faster than LuaJit
<Papierkorb_>
it's not turing complete, right?
<Papierkorb_>
Or better: It's not general purpose
<Groogy>
it's not no, not supposed to be either really
<Papierkorb_>
If I remember the snippet you posted correctly, then you wouldn't benefit from LLVM at all.
<Groogy>
well our more advanced scripts would, like the on_action hooks etc.
<Papierkorb_>
If it's actually bogging your game down (huh), I'd imagine faster code paths to do the trick. Maybe a "Query planner" (in RDBMS terms) to e.g. analyze the script and find stuff that could be cached, or parallelized
<Groogy>
where we have more conditional logic which is often based on static things you can now ahead of time and optimize for
<Groogy>
we already do those things
<Groogy>
for instance you can fetch out "all characters who have this specific traits" and that is already cached
<Papierkorb_>
I guess correctly you already profiled the bottlenecks in your game?
<Groogy>
yepp
<Papierkorb_>
Is the time spent actually calculating something inside the script itself?
<Groogy>
this was more of a crazy idea and wasn't 100% serious
<Groogy>
but it would have some benefits we are way too lazy to just implement ourselves
<Papierkorb_>
I'm not aiming at LLVM :P
<Groogy>
yeah for instance the AND trigger (conditional script) takes up a lot of time
<Groogy>
since it is used everywhere it will turn up in the profilers a lot
<Groogy>
and most of the time we could potentially optimize them away, but they work as a sort of language construct
<Groogy>
like the NOT = {} is an AND that just reverts it and the scripters often write them next to each other since it looks better when they could in fact be merged (the loadtime optimizers does this right now)
<Groogy>
ugh in fact we should just hire someone to sit fulltime and work with our language ( ´_ゝ`)
<Papierkorb_>
.. Actually sounds fun
<Groogy>
I did a proof of concept debugger but never got time to finish its interface, just having someone working dedicated on that would be great
<Groogy>
speaking of debugger, I haven't hooked it up yet in VS Code, how well does Crystal debugging work with VS Code?
<Groogy>
if anyone knows
<Papierkorb_>
If there's a good gdb plugin, it should work
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<yxhuvud> groogy: .are you using regular lua or lua-jit?
<FromGitter>
<yxhuvud> never mind,, the answer is neither and I got that after reading through the backlog :D
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
<Groogy>
heh :P
<Groogy>
Papier meant "why don't you just use Lua"
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Papierkorb_>
Not at all. I asked if you considered transpiling to Lua, hence using it as execution engine.
<Papierkorb_>
Which wouldn't make much of a difference if the code ran within it is not what's resource heavy
RX14 has quit [Excess Flood]
RX14 has joined #crystal-lang
early has quit [Quit: Leaving]
early has joined #crystal-lang
RX14 has quit [Excess Flood]
RX14 has joined #crystal-lang
hmans has quit [Read error: Connection reset by peer]
hmans has joined #crystal-lang
<crystal-gh>
[crystal] MakeNowJust opened pull request #5102: Support varargs for ProcLiteral (master...feature/crystal/proc-literal-varargs) https://git.io/vdryb
<Papierkorb_>
^ Wondering how you'd access the ... pack
<Papierkorb_>
Also, with that change, you should be able to implement libc in Crystal .. for C programs .. yeaaaah
<crystal-gh>
[crystal] MakeNowJust opened pull request #5103: Add VaList API (master...feature/va_list) https://git.io/vdr9J
<Papierkorb_>
^ That explains it
<FromGitter>
<yxhuvud> Do procs support *rest args? If not, then it would be nicer if it reused the *args syntax but did the VaList.open stuff under the hood.
<Papierkorb_>
Not possible, you don't know how large a va list i
<Papierkorb_>
is*
<Papierkorb_>
Which is why I proposed VaList having a Iterator-style API instead
<Papierkorb_>
yxhuvud, (at least on x86) a va_list is really just a pointer to the stack, which is moved on it accordingly each time you read a value from it. The caller simply pushes all values, jumps to you, and later on, pops all values again. The caller knows how many items there are, the callee does not.
<Papierkorb_>
yxhuvud, which is why such C functions commonly have a "int count" argument, or expect you to pass a NULL as last element.
<Papierkorb_>
E.g., `printf("%x %x %x\n");` misses elements for the %x's. While your compiler should complain about it, it'll compile through. Behaviour of this is undefined, you'd end up reading arbitrary stack space instead.
<FromGitter>
<yxhuvud> right. I suppose what I proposed would imply \*args for procs would return something that isn't an array. But it is still nice to get a name to it and have it in a variable instead of some magical context depending module
<Papierkorb_>
In turn, this is why `printf(some_user_controllable_string, foo, bar, baz)` is so dangerous. Even worse, this printf call could be abused for writes to the stack, making this not only a possible crash, but actually a code execution.
<Papierkorb_>
yxhuvud, I don't like `*` used there, imho too similar to `*args` everywhere else. I get your intention, but I'd rather have a forced "break" of it here as reminder for users. You could otherwise expect `some_crystal_method(*args)` to work, which is not possible
<FromGitter>
<yxhuvud> some other prefix perhaps, then, to mark the difference?
<FromGitter>
<yxhuvud> +args ?
<Papierkorb_>
I'd prefer the allowed syntax not to change, I'd be fine if `VaList` was magical
<Papierkorb_>
Not change because that's another thing to learn and teach, and for tools to know, for a syntax that most won't affect
<FromGitter>
<yxhuvud> Hmm, what content is it in a VaList? Would it need to be def foo(va_args : VaList(Type)) ?
<FromGitter>
<yxhuvud> ie are they typed or limited to something generic that has to be cast?
<Papierkorb_>
iirc, the standard says about it being the size of a `void*`. I might be wrong though
<Papierkorb_>
No, untyped unknown-length glory
<Papierkorb_>
It's literally a stack pointer
<Papierkorb_>
And it's exactly as dangerous :)
<FromGitter>
<bew> super unsafe x)
<FromGitter>
<bew> Let's add a VaList.to_super_unsafe_pointer (In case you didn't know it was)
claudiuinberlin has joined #crystal-lang
<Papierkorb_>
It's actually just as unsafe as doing `def foo; StaticArray(Int32, 123).new.to_unsafe.to_slice(123); end`
<Papierkorb_>
Just that a VaList has a better chance to not crash the application I guess
<Papierkorb_>
bew, But I think it'd be fine. Barely anyone would use it, I think it needs to be there for completions sake first, as there will be some (few?) users for it in the long run. But can't say I have missed it up to this point :)
<FromGitter>
<krypton97> Has anyone worked with opengl here :)?
<Papierkorb_>
Groogy is building a game engine and a game, which happens to use OpenGL
<Papierkorb_>
krypton97
<FromGitter>
<bew> Papierkorb_ yes right, in fact any Pointer is unsafe, so yes..
<Papierkorb_>
Well some are safer than others. Reference is literally a pointer
<Papierkorb_>
Just a pointer that's guaranteed to be non-dangling
<Groogy>
Yes I have worked with OpenGL
<Groogy>
you had a question @krypton97?
<Papierkorb_>
bew, Don't fear the concept, but its misuse. E.g., Clang is using tons of references over pointers. It does feel foreign at first, really, but one gets used to it. Those are pointers too, but the compiler guarantees me that they're correct. Really interesting feel it gives, in C++/Qt you only used refs to pass around value types, but not objects. If e.g. the compiler would (try to) track pointer usage, you could make them pretty safe in
<Papierkorb_>
Crystal, as it could catch misuse like returning a slice of a static array
<Papierkorb_>
)Not saying this is easy at all)
<Papierkorb_>
Groogy: Oh and please keep us posted on your progress :)
<crystal-gh>
[crystal] ysbaddaden opened pull request #5104: Add (Half)SipHash PRF and integrate it into Crystal::Hasher (master...std-siphash) https://git.io/vdrxe
<FromGitter>
<bew> oh I don't fear the concept at all, I know C & C++ enough to avoid doing stupid thing, and already had fun with quite a good number of full projects in those languages (thanks school!)
<FromGitter>
<bew> I was just pointing out that it was sth quite unsafe to expose to crystal, but in the end it'll be almost as unsafe as everything touching lib bindings, so it's not "especially" unsafe
<FromGitter>
<bew> Papierkorb_ well here's Int8.slice & Int8[] in the same vein (top of src/number.cr)
<Papierkorb_>
„Why“ is really I can come up with bew
<Papierkorb_>
*all I can
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<georgeu2000> `FROM gliderlabs/alpine:3.6` fixed it.
ducklobstr has joined #crystal-lang
<ducklobstr>
I know that you can access constants inside a macro, but can you also set constants inside a macro?
<ducklobstr>
not sure if this is the right approach to begin with, but given an array of static files (defined in a FILES = [] constant) i want to create a subsequent set of constants that are essentially the filenames (with some gsubing)
<oprypin>
ducklobstr, u can. {% A << "f"
<ducklobstr>
what is the difference between {{ and {% ?
<Papierkorb>
because technically, String#intialize could raise, and thus text would never be initialized when reaching the rescue
<FromGitter>
<imonmyown> but I really need the ensure clause :(
Creatornator has joined #crystal-lang
<FromGitter>
<imonmyown> Well rescuing the raise from String#initialize doesn't really ensure `text` is simply `String` and not `(String | Nil)`, right?
unshadow has quit [Quit: unshadow]
<FromGitter>
<imonmyown> What's the right way to solve this problem?
<FromGitter>
<faustinoaq> @imonmyown but arguments seems to work as you want https://carc.in/#/r/2w1y
<FromGitter>
<imonmyown> @faustinoaq thanks man, but I kinda need a way to do that without args
<FromGitter>
<imonmyown> I probably really need to raise a question on SO
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
Ven is now known as Guest75286
Guest75286 has quit [Ping timeout: 255 seconds]
<crystal-gh>
[crystal] ysbaddaden opened pull request #5106: Fix: CI is mising gmp dependency on macOS (master...fix-ci-missing-gmp-dependency-on-osx) https://git.io/vdoSF
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Creatornator has joined #crystal-lang
tax has quit [Quit: Leaving]
claudiuinberlin has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wontruefree has joined #crystal-lang
Creatornator has joined #crystal-lang
Creatornator has quit [Client Quit]
<FromGitter>
<krypton97> Hey Groogy, how may I find you on github?
<FromGitter>
<krypton97> Looking to read through that game engine
<Papierkorb>
krypton97, @Groogy on Github
<FromGitter>
<krypton97> I'm aiming to make a gui lib, but couldn
<FromGitter>
<krypton97> t find that much about shaders..
<FromGitter>
<krypton97> ty
Creatornator has joined #crystal-lang
<Yxhuvud>
if you only need a gui lib you may find the qt bindings more useful
<crystal-gh>
[crystal] ysbaddaden opened pull request #5107: Measure time with monotonic clock (master...std-measure-time-with-monotonic-clock) https://git.io/vdKfb
<crystal-gh>
[crystal] ysbaddaden closed pull request #3827: Add Clock.monotonic for measuring elapsed time (master...feature-clock-monotonic) https://git.io/vdKJm
<FromGitter>
<raydf> Hi everyone
alex`` has quit [Ping timeout: 246 seconds]
<FromGitter>
<raydf> How can i add 1 day to a Time value?
<FromGitter>
<bew> `Time.now + 1.day`
<FromGitter>
<raydf> Thanks @bew
<FromGitter>
<bew> method `Int32#day` and `Number#days` are available for that!
<FromGitter>
<raydf> i was reading the api of Time and forgot to check the Int32 api
<FromGitter>
<bew> in practice, those methods creates a `Time::Span` object, and this is then used to add a duration to a `Time`
<oprypin>
raydf, that's terrible design tho, nothing to blame you for :p
<FromGitter>
<faustinoaq> > that's terrible design tho ⏎ ⏎ oprypin, do you mean about api design ?
<oprypin>
faustinoaq, yes. never in my life did i want to see an API like 5.day
<FromGitter>
<raydf> @oprypin, i believe this is because Crystal want to keep the syntax/API closer to ruby
<oprypin>
we don't want aliases, oh except when it's a one letter difference to make a "cool" DSL (talking about .day being an alias to .days)
<oprypin>
not to mention the ridiculousness of asking a number to give you a timespan
<FromGitter>
<raydf> after @bew helped me i research a little bit about that API design
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<faustinoaq> oprypin, Well, Crystal follows Ruby and his extreme readability `this could_be a_ruby, or_crystal; code after 1.minute; writing this_comment` 😅
<oprypin>
you're killing me.
<FromGitter>
<bew> > x)
ducklobstr_ has quit [Ping timeout: 260 seconds]
ShalokShalom_ has quit [Ping timeout: 240 seconds]
<FromGitter>
<raydf> Maybe later i could discuss changes for the API docs and putting this kind of examples in the Time and Span modules