<daurnimator>
e.g. I have a `var foo: ?sometype = null;` and I want to pass it as an out-arg to a function: `somefunc(&foo)` however that function takes a `sometype`, not a `?sometype`
<daurnimator>
trying to pass it like that gets "expected 'sometype' got '?sometype'"
<daurnimator>
however trying to pass it as `&foo.?` fails with "attempt to unwrap null"
<daurnimator>
andrewrk: I'm getting misc failures in std/event/loop... occasional errors from waitFd with FileDescriptorAlreadyPresentInSet
_whitelogger has joined #zig
doublex_ has joined #zig
doublex__ has quit [Ping timeout: 250 seconds]
adamkowalski has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
adamkowalski has quit [Ping timeout: 265 seconds]
mahmudov has quit [Ping timeout: 265 seconds]
dingenskirchen has quit [Remote host closed the connection]
dingenskirchen has joined #zig
adamkowalski has joined #zig
adamkowalski has quit [Ping timeout: 268 seconds]
muffindrake has quit [Ping timeout: 276 seconds]
muffindrake has joined #zig
<daurnimator>
anyone managed to get std.event.loop actually working?
* daurnimator
now rewatching the chat server stream... cause this isn't adding up
adamkowalski has joined #zig
adamkowalski has quit [Client Quit]
<daurnimator>
http://sprunge.us/BirF5a <== zig segfault that I have no idea where to start on...
_whitelogger has joined #zig
<mq32>
<daurnimator> however trying to pass it as `&foo.?` fails with "attempt to unwrap null"
<mq32>
but somefunc does initialize foo with a fresh something, right?
<daurnimator>
in fact in my code its: `if (a.foo == null) getafoo(&a.foo);`
<mq32>
aa yeah
<mq32>
you still have to initilaize the optional before unwrapping it
<mq32>
just use the @as(something, undefined) before getafoo
<daurnimator>
this seems like a language "bug
<daurnimator>
oh initialize to undefined? interesting
<mq32>
nah, why?
<daurnimator>
is that guarnteed to not initialize it to null?
<mq32>
yes
<daurnimator>
how so?
<mq32>
if you assign it a "undefined something" instead of an undefined ?something
<mq32>
var x : something = undefined;
<mq32>
var y : ?something = x;
<daurnimator>
ah k. good solution I think; thanks!
<mq32>
^= second line just does fill the y with a value, so it is not null
<mq32>
it doesn't mean the value must be meaningful
<daurnimator>
I feel like this is one of those things that need to be written down. I just learned something that someday someone will be stuck racking their brains trying to figure out with a deadline
<mq32>
hmm
<mq32>
yeah there's a lot of fine grained detail in the language that is "obvious" as soon as you think about it
<mq32>
but not obvious if you didn't grasp the semantics completly
<daurnimator>
"set X to undefined if you want to access it" is not obvious at all
<mq32>
nah, that's not the idea :D
<daurnimator>
s/access it/take its address/
<mq32>
set x to an undefined, but non-null value
<shakesoda>
i feel like i have no idea why a lot of the dots in zig are needed
<shakesoda>
not like, opposed to them being there, i just don't quite understand
<shakesoda>
particularly .{ .* and .? seem really awkwardly placed, and i'm sure for a reason, i just don't know it
<mq32>
.* and .? are quite nice because they remove two unary prefix operators and replace them with postfix operators
<mq32>
so pointers and optionals moore behave like structs where you can access the content as a field
<mq32>
.* is the same as .? or .field
<mq32>
"access contents of the type"
<mq32>
.{ … } isn't a syntax a like, but i can understand why it's there
<shakesoda>
that makes sense for the .* and .?
<shakesoda>
if i think of it with the same frame as .field access it isn't weird anymore
<mq32>
yep
<mq32>
and now if you think about it, "*ptr" is a weird syntax in C :D
<shakesoda>
the weird i have always known ;)
<mq32>
yeah, that's the point
<mq32>
a lot of people are weirded out by "different", but not by the absurd stuff they use every day
<shakesoda>
zig seems consistently good about things having a reason for being
<mq32>
yeah that's an important design decision
<mq32>
i just learnt that ada has always all language features :D
<shakesoda>
it increases the amount of stuff i have to process to figure it out :P
<shakesoda>
i don't feel strongly about this in abstract, i would have to use it
<mq32>
most brains parse "'address" the same as they parse "&" :D
<shakesoda>
mine certainly doesn't!
<gonz_>
Brains read patterns, not letter by letter
<gonz_>
I doubt yours does
return0e has quit [Ping timeout: 265 seconds]
knebulae has quit [Read error: Connection reset by peer]
return0e has joined #zig
<gonz_>
Your brain is likely intrinsically going to have a harder time making a difference between `&some_variable` & `*some_variable` than it would actual words representing those things, it's just that you've given it plenty of training to do so.
<shakesoda>
dunno, but i don't read the operators as their words when i read code to begin with
<mq32>
at some point you also stop reading 'address as a word, but as semantics
<mq32>
it's the same difference at the end
<mq32>
it's just what you are used to and what not
<shakesoda>
yeah, but 8 times the characters
<shakesoda>
that can add up to a lot of visual noise very fast
<mq32>
conveying more information anyways
<mq32>
@as() also adds a lot of visual noise to zig, sadly :(
<shakesoda>
it definitely does
<daurnimator>
@as is pretty rare in my experience
<mq32>
interfacing with SDL is quite horrible right now :D
<shakesoda>
i noticed that when doing the few replacements on my end but it was infrequent enough not to feel too strongly
<shakesoda>
there are quite a few pain points interfacing with sdl
<shakesoda>
i noticed, all the functions i searched for first are missing :D
<mq32>
i'm building the lib as i require the features
<mq32>
:D
<shakesoda>
(first was SDL_GetPerformanceCounter and SDL_GetPerformanceFrequency)
<mq32>
haha
<mq32>
maybe the most uninteresting features to me right now
<shakesoda>
then SDL_GL
<mq32>
but go ahead, implement them! :D
<daurnimator>
mq32: you got event/loop stuf working before?
<mq32>
never used it
<mq32>
i'm not that much a fan of async/await for I/O semantics
<shakesoda>
well, they're quite a lot better than SDL_GetTicks is
<mq32>
shakesoda: so? :D
<mq32>
SDL_GetTicks has roughly my framerate resolution
<mq32>
and i'm always locking in on VSync
<shakesoda>
getticks accuracy is atrocious though D:
<shakesoda>
ms isn't nearly enough
<mq32>
enough for animation anyways ¯\_(ツ)_/¯
<mq32>
depends on what you are doing
<mq32>
i seldom use it anyways except for main loop counting
<shakesoda>
you'll have timing drift almost instantly with only ms precision
<mq32>
nah
<mq32>
:D
<shakesoda>
that is probably acceptable in your case, but i really don't like that kind of stuff
<mq32>
fixed timestep loops work quite well
<mq32>
they don't drift in any way, the just may "stutter" for a frame or so
<shakesoda>
stuttering is the most annoying visual artifact of them all!
<shakesoda>
my eyes, they bleed!
<mq32>
i never had any stuttering
<mq32>
but i'm not doing "heavy heavy game logic", but shallow game logic stuff
<mq32>
so game logic and physics run with 400 FPS
<mq32>
where a missing frame doesn't hurt you
<mq32>
and visuals run in sync with the screen refresh rate
<shakesoda>
i'm doing heavy enough logic that i have tools for measuring the time every system takes, and missing frames is real bad for the kind of projects i work on
<mq32>
as always: it depends on the use case
<shakesoda>
yes, of course
<mq32>
but yeah
<mq32>
if you want to contribute to the wrapper/sdl lib, go ahead :D
<shakesoda>
i will certainly give it a go
<shakesoda>
good excuse as any to work on my zig-fu, and transplant some of the sdl stuff i've already got here
rappet has quit [Ping timeout: 252 seconds]
rappet has joined #zig
<mq32>
i'm gonna improve the "meta" of the repo a bit right now
<mq32>
[x] The compiler crashes if you look at it funn
<mq32>
:D :D
<daurnimator>
ovalseven8: zig 1.0 is still a while away. I'm not familiar with any estimates
ovalseven8 has quit [Quit: Leaving]
<stratact>
So... I was creating a `setFilter()` method for my iterator and I had it accept a function type as a parameter, only to realize I forgot... I can't use closures or have functions be anonymous either... I guess I have to write a normal function?
<daurnimator>
stratact: yeah and bound functions crash the compiler if you try and pass them
<stratact>
wait, why?
<stratact>
ICE?
<stratact>
...closures must be super magical to implement I suppose
<mq32>
stratact: closures are hard to get right
<mq32>
what gets captured, how does it get captured, where is the data stored?
<stratact>
Yeah, that's too magical even for Zig. Then I'll toss my filter closure adapter idea and come up with another stratact-egy
<mq32>
well, you can always use semi-anoynmous functions for filtering
<mq32>
give me a second
<daurnimator>
stratact: or fix the bug :P
<Snektron>
Wait, couldn't closured be implemented as a kind of "async function literal"
<stratact>
mq32: I'm still impressed, even if it's a downward closure. I love it and it makes sense from a stack (and frame) point of view
<stratact>
Heh, I've been trying to write something for the past 8 minutes but I didn't want to sound overly appreciative because of how ignorant I am. :)
* stratact
is going to take another nap because he got mind blowned by a simple (but cool!) concept
jokoon has joined #zig
<frmdstryr>
daurnimator: anyone managed to get std.event.loop actually working?
<andrewrk>
the only sin in zig is using [*c] pointers :P
<stratact>
:)
ur5us has joined #zig
<stratact>
andrewrk: you can see why I was so impressed, right? Zig's ability to adapt itself to different programming styles by its own universal style.
<stratact>
Alright I had enough refactoring fun, time to get stuff done.
lukeholder has joined #zig
ur5us has quit [Ping timeout: 250 seconds]
lukeholder has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<mq32>
i'm really looking forward to free function literals
<mq32>
they will make quite a difference again
<mq32>
and they unify function-, type- and var declarations
<stratact>
yes, very much so. It feels like I'm healing listening to it.
<stratact>
I'm listening with those Audio-Technica headphones with large speakers, which allows me to hear more details in the song
<shakesoda>
stratact: i have a couple pairs of those, they are great
<stratact>
shakesoda: with the 3D-wing head support, right? :)
<shakesoda>
stratact: yes
<stratact>
I'll need to ping andrewrk for more of his favorites songs whenever I'm feeling down.
<stratact>
I think I'm pretty much done with the terminfo text source parsing. I collected the names of the terminals in a `names` table and the bool, strings, numerics values in a `caps` table, similar to daurnimator's Lua approach. However is there a way to do debug prints to check a value's data representation with stdout?
<Snektron>
andrewrk, rameses b is a good choice
Akuli has quit [Quit: Leaving]
ltriant has joined #zig
<stratact>
I suppose the "{?}" format is what I was looking for, but the pointers hide the entry data :(
<andrewrk>
var args's days is numbered
dbandstra has joined #zig
mahmudov has quit [Remote host closed the connection]
WendigoJaeger has joined #zig
wootehfoot has quit [Read error: Connection reset by peer]
casaca has quit [Ping timeout: 250 seconds]
dbandstra has quit [Ping timeout: 240 seconds]
<Snektron>
Whats the status on #1348?
<andrewrk>
Snektron, the info/labels there is up-to-date and correct
<Snektron>
So i guess there is nothing to hold it up?
<andrewrk>
nope, it's just a contributor friendly PR away
<Snektron>
Guess i'll go take a look :)
dbandstra has joined #zig
<daurnimator>
oooo, comptime fields.....
emekankurumeh[m] has joined #zig
<emekankurumeh[m]>
would it be possible to set up ci for mingw-w64?
<Snektron>
I notice that there isn't any checking on builtin functions names in std/zig
ur5us has quit [Ping timeout: 250 seconds]
<Snektron>
andrewrk, should there be any checking on that at parsing stage?
<andrewrk>
emekankurumeh[m], what you're asking for is to add support for this as a first-class build environment, blocking master branch pushes and PR merges if they break the build for this environment. I'll consider it
<andrewrk>
Snektron, semantic analysis is an OK place to catch this problem, since it is clear to the parser what the programmer intended. a message such as "xzy is not a builtin function" is better than "unknown token: @xzy"
<WendigoJaeger>
andrewrk: and it's even better than devkitARM because you don't need an extra program just to update the ROM header, gotta love comptime features
<andrewrk>
:)
<Snektron>
andrewrk, i'm unsure where to place typeOf/TypeOf substitution. I considered in the handling of BuiltinCall in renderExpression, but there is currently no way to render something other than a token without directly rendering a string
<Snektron>
Another place is in renderTokenOffset, but that seems wrong too
<Snektron>
I suppose the best place to add this is in tokenSlicePtr in ast.zig
<andrewrk>
Snektron, in this case, just render the string, don't call the token function
<Snektron>
Would that not create problems with formatting of stuff after the name?
<andrewrk>
you can look at how use / usingnamespace did this
<Snektron>
ah sure, good idea
<andrewrk>
yeah it'll mess up line comments after that token, but *shrug* this is a convenience thing that is only intended to last for 6 months. probably nobody will put a line comment after @typeOf() during that time
<Snektron>
famous last words
<andrewrk>
nobody noticed with usingnamespace :)
<andrewrk>
if you want to pioneer a more sound way to do it, go for it
<Snektron>
I suppose a good point would be the tokenSlicePtr call i was talking about
<Snektron>
Simply define a list of substitutions by token and matching text, and provide a replacement text
<daurnimator>
andrewrk: 16:15:24 <daurnimator>http://sprunge.us/BirF5a <== zig segfault that I have no idea where to start on...