<daurnimator>
andrewrk: I asked you a while ago about what should go into os.zig vs fs.zig and your answer suggested my WIP for windows in that PR wasn't the route you wanted
<daurnimator>
we should discuss that further
<daurnimator>
will you be around in ~3 hours?
<andrewrk>
probably not, I should be in bed by then
<andrewrk>
I'm working on the pull requests, oldest to newest
<TheLemonMan>
alexnask, yo, can you dump all the four WSL vdso phdrs?
<alexnask>
sure give me a minute
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<alexnask>
TheLemonMan, updated the github comment
<alexnask>
Thanks for taking a look, I appreciate it, I find WSL super useful
itszath has quit [Remote host closed the connection]
dwdv has joined #zig
<TheLemonMan>
it seems Microsoft decided to ship a prelinked vdso, something that Linux dropped support for back then with the 3.16 version
<daurnimator>
TheLemonMan: what is a prelinked vdso?
<TheLemonMan>
a vdso with a fixed & high load address
<daurnimator>
and is there an auxval that indicates that or not? or how do you know?
return0e_ has joined #zig
<wilsonk>
has anyone built an SDL2 app on win10 lately? I am getting a redefinition of main error when trying to 'usingnamespace @cImport({ @cInclude ("SDL.h"); ...
<TheLemonMan>
daurnimator, eh that's a good question
<daurnimator>
VER_FLG_BASE?
<alexnask>
I can try to install Win10 insider to get WSL2, perhaps they use a concentional vdso
<alexnask>
Can't find any info on it online though (or any vdso related issue in other software on wsl)
<TheLemonMan>
I wonder if everything worked just fine only due to C + silently overflowing
<daurnimator>
so what.... change to +% and issue fixed?
<alexnask>
I'm trying that atm
<alexnask>
I overflow elsewhere now
<alexnask>
:D
<alexnask>
I'll just change all overflows to use the unchecked version and report back
<TheLemonMan>
hah
<TheLemonMan>
the idea is to make the symbol lookup fail so that the vdso won't be used
<TheLemonMan>
that's the lazy solution, the proper one is to detect and offset the addresses
<alexnask>
Changing lines 25, 43 and 74 to use the wrapping versions of the operators works
<TheLemonMan>
but 3.16 is an ooold kernel and WSL1 is on the way out so...
<TheLemonMan>
alexnask, "works" as in the symbol lookup succeeds or as there's no more panic?
<alexnask>
1 sec let me try
<alexnask>
Lookup succeeds
<TheLemonMan>
oh well, two (or more) wrongs make a right after all
<alexnask>
lol
ur5us has joined #zig
nepugia has quit [Ping timeout: 256 seconds]
alexnask_ has joined #zig
alexnask has quit [Ping timeout: 260 seconds]
alexnask_ is now known as alexnask
frmdstryr has quit [Ping timeout: 255 seconds]
dhawkie has quit [Read error: Connection reset by peer]
dhawkie has joined #zig
ur5us has quit [Ping timeout: 256 seconds]
<dhawkie>
hi. i am getting compile errors from included C headers: pub const gwset_num_threads = @compileError("unable to translate C expr: expected ')'' here");
<dhawkie>
this is the line from the header: #define gwset_num_threads(h,n)>->---((h)->num_threads = n)
<dhawkie>
most of the "defines" seem broken, is this to be expected?
<TheLemonMan>
what version of the zig compiler are you using?
<dhawkie>
0.5.0+00be93456
<dhawkie>
very recent
<dhawkie>
latest commit actually
<dhawkie>
it was the same with 0.5.0+00be93456 (28 feb)
<dhawkie>
very new to zig, so i am not sure if it's somehow my fault or what. the C libraries are third party, but open source
<dhawkie>
zig manages to translate most of the rather complex header file, but fails on what seems like all the "defines"
<dhawkie>
* it was the same with bee4007 (28 feb)
<TheLemonMan>
yeah please open a ticket for that
<dhawkie>
sure, will do. thanks
<TheLemonMan>
translate-c is not expected to correctly translate _all_ the defines but here we have a parsing error
<dhawkie>
I figured it should, I will create a ticket with relevant info
<mq32>
the main problem with .NET Standard is that it's incompatible to previous versions
daex_ has joined #zig
daex has quit [Ping timeout: 260 seconds]
<mq32>
so you now have 20 years of .NET libraries
<mq32>
and you cannot use them anymore
<mq32>
and if you have an classic .NET project, you cannot use the newer libraries
<fengb>
Java 8 released a bunch of new standards that pulled in great features from common libraries. The end result: all projects are a mix of all of those common libraries and Java 8 -_-
<mq32>
oh, same problem :D
<mq32>
i think C++ did the same thing
<alexnask>
C++ has been importing Boost stuff in the std a lot yes
waleee-cl has joined #zig
<alexnask>
Spilled a half a cup of coffee on my keyboard *_*
<fengb>
It still works!
<alexnask>
Yeah I was cleaning up for like half an hour :D
<fengb>
Just do it the JS way: can't have duplicate standards if there are no standards
<waleee-cl>
I did the same, but the leds in it got "weird" so had to dismantle it to dry everything out
<alexnask>
I unplugged it straight away and checked the switched and pcb, got lucky I guess :p
<mq32>
the good thing about all those package manger stories are: we as the zig community can learn from that before making the same mistakes again
<waleee-cl>
mine is a mechanical one that uses a separate rubberdome-pcb for the media- & led-controls
<alexnask>
Wow weird design waleee-cl
<waleee-cl>
got coffe inside the rubberdome-keys
<alexnask>
mq32, Yeah all we have to do is write a piece of software that literally everyone will like /s
<waleee-cl>
alexnask: its a semi-newish corsair K65, I would imagine that it's qute common if the media-keys isn't clicky on a mech.keyboard
<mq32>
alexnask: yep, easy as that *grin*
<alexnask>
I guess, you can't fit a cherry switch in there anyway.
<mq32>
but i think andrews plan is unusual, but not bad
<fengb>
It's a social problem. I still think it's possible to solve, but not technologically
<mq32>
i think what people hate about package managers is "not being in control"
<companion_cube>
what problem?
<companion_cube>
(it's monday morning, sorry0
<fengb>
All problems 🙃
<companion_cube>
I mean, the main problem of zigpm is that it doesn't exist yet, right? :p
<TheLemonMan>
vaporware is the best software
<gchristensen>
definitely the softest of software
<Snektron>
<alexnask "Spilled a half a cup of coffee o"> Spilled water on mine this morning
<Snektron>
Its surprisingly resillient against it
<Snektron>
Just had to dry it
<alexnask>
Water spills are fine in 99% of cases
<fengb>
Did you boil out the water? :P
<alexnask>
Unless it has a crazy mineral concentration
<alexnask>
Coffee can make switches sticky though
<alexnask>
TIL about `dbg_ir_break`
<alexnask>
nice
<companion_cube>
TheLemonMan: so if you accidentally delete all your source code, does it make your program sublimeware?
<alexnask>
rm -rf is my favorite optimizer
<TheLemonMan>
solving a problem with 0 lines of code is definitely the best outcome
<mikdusan>
I prefer rm -fr
<fengb>
Negative lines is better
<fengb>
Bleh... I keep kicking around the idea that I should finish my templating library
<fengb>
To generate HTML easier. But I have too many half-finished projects
<TheLemonMan>
that's the way to go, drowned in a sea of half-started projects
<companion_cube>
you don't necessarily templates, you could have combinators
<companion_cube>
to build a html AST (with an arena it's fast)
<fengb>
That'd still have nothing to do with whta I want to do -_-
<fengb>
And because Zig's functional stuff isn't great, that code would look nothing like the output so it wouldn't solve my issue here
<companion_cube>
what would "Zig's functional stuff" be anyway? :)
<fengb>
Well, I'd need map/filter for it to look less crappy
<fengb>
Otherwise the control flow will swamp the actual contents and it'd be barely scannable
<fengb>
I should just invent my own Lisp that runs at comptime
<companion_cube>
or use D :p
<companion_cube>
but more seriously, comptime closures?
<fengb>
At the end of the day, the templating engine generates an AST using text, so it'd be almost the same underneath the covers. Except it'd look nicer to use
<mq32>
fengb, what about the approach of std.fmt and use a pub fn renderHTML or something?
<fengb>
I had one half-built before I realized I needed comptime allocation. Then I realized I can work around it by preallocating... but lost interest before I circled back
<fengb>
But... it's also not bad enough that I want to solve the problem for real
<fengb>
I also like to kick around the idea that sexprs map to HTML super well and I want to invent my own language for that
<companion_cube>
fengb: I said combinators, not writing printfs :p
<companion_cube>
sexps? sgml? :P
<andrewrk>
alexnask, what does `uname -r` report in that WSL you're using?
<alexnask>
andrewrk, 4.4.0-18362-Microsoft
<alexnask>
It's the latest build I think, I updated yesterday to check if the vdso code would work
<andrewrk>
thanks, just curious
frmdstryr has joined #zig
Barabas has joined #zig
<Barabas>
`zig fmt` seems to create some backup file with a name like `gIYUjiYHUjwqWLgp`
<andrewrk>
fengb, at handmade seattle, casey never even stopped by to visit zig's booth
<Barabas>
On Windows by the way.
<andrewrk>
Barabas, hmm sounds like there may be a semi-recent regression in std.fs.AtomicFile
<Barabas>
I'm fiddling around to see when it triggers, because it doesn't happen in every case
<Barabas>
Only when using the full path it seems...
<Barabas>
Also it fails to open files which start with ./
<Barabas>
or .\
<Barabas>
unable to open '.\window.zig': error.FileNotFound
<Barabas>
unable to open './window.zig': error.BadPathName
<Barabas>
I'll make an issue I guess or maybe two
<andrewrk>
thanks
return0e_ has quit [Ping timeout: 255 seconds]
<fengb>
Oh I think I've seen some of Casey's streams. He sounds... smart >_>
<fengb>
I remember a rant about undefined behavior when subtracting 2 different pointers
<andrewrk>
like j blow, he's smart, opinionated, and lacks perspective
<fengb>
Yeah that's what I took away too. Trying to be nice :P
<companion_cube>
who's casey?
<fengb>
Guy who made Handmade Hero. I posted a rant-y twitter link earlier
<companion_cube>
ah, the thing on package manager :s
<companion_cube>
rolling my eyes at the assessment of rust
<companion_cube>
lockfiles are a thing, man
<fengb>
Nah, gotta invent your own
nepugia has joined #zig
recombinant has joined #zig
<andrewrk>
btw does anyone here run freebsd as their main os?
nepugia has quit [Ping timeout: 240 seconds]
o_O has joined #zig
o_O is now known as Guest55814
nepugia has joined #zig
metaleap has quit [Ping timeout: 258 seconds]
_Vi has quit [Ping timeout: 272 seconds]
<Barabas>
Is it on purpose that zig fmt puts my multi-line function calls in one line, while it puts struct initialization on multiple lines, but not tuples? Hmm... looking at the short style-guide it doens't quite follow that.
<fengb>
Adding a trailing comma forces multi line rendering
<fengb>
func(a, b, c, )
<Barabas>
oh
<Barabas>
Let me check
<Barabas>
Yeah that might explain some of the weirdness I'm seeing. Thanks.
<andrewrk>
Barabas, you can make zig fmt switch to one line or switch to multiline with the addition or deletion of that trailing comma
<Barabas>
Yeah I see. That makes it a lot better.
<fengb>
Fake configuration :P
<Barabas>
=D
Akuli has joined #zig
Guest55814 has quit [Quit: Leaving]
nepugia has quit [Ping timeout: 256 seconds]
metaleap has joined #zig
nepugia has joined #zig
_Vi has joined #zig
jjido has joined #zig
klltkr has joined #zig
klltkr has quit [Ping timeout: 255 seconds]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us has joined #zig
<fengb>
Hmm... so once I "finish" my wasm vm, I want it demoable online
<fengb>
So does that mean I should compile it into wasm?
<fengb>
Turtles all the way down
<nepugia>
the question is then, can you compile it to js? ;)
<BaroqueLarouche>
So you like wasm so I put an wazm into your wasm
<fengb>
Michaël Larouche: perfect tagline 😂
<BaroqueLarouche>
fengb: Put that in the README with the Xzibit picture
<fengb>
LLVM doesn't have a native JS, but it should be pretty easy to use binaryen to convert it
<fengb>
Then I can claim wazm to be a true polyfill -_-
<alexnask>
Compile it into wasm, write a wasm -> js compiler in wasm, run it in the vm on the browser to compile the wasm vm to js
<fengb>
But when it is, we can have wazm to compile Zig into wasm to run it on wazm to compile wazm
<nepugia>
Soon computers will have reached enlightenment, where they just push data around instead ;)
klltkr has joined #zig
<fengb>
I suppose I should get it actually running things :/
<fengb>
I've gotten it to parse/validate an empty wasm file so lots of success
<andrewrk>
fengb, I think it is possible to compile zig to wasm
<andrewrk>
I saw someone get clang/llvm built to wasm in a docker container
<fengb>
Yeah I've been meaning to get around to trying it out
<fengb>
But I meant stage2, which is just as much vaporware as wazm ;)
<andrewrk>
I see
return0e_ has joined #zig
return0e_ has quit [Client Quit]
<fengb>
Wow, mapping wasi to wazm will probably be super easy :D
mahmudov has joined #zig
mokafolio has quit [Quit: Bye Bye!]
mokafolio has joined #zig
<alexnask>
fengb, I don't think those proposals are equivalent, introducing a tuple { ... } syntax would still not be enough to create such a type at comptime e.g. from a slice of types
jjido has joined #zig
<fengb>
Oh... @Tuple would require something like @reify
<fengb>
They seem like competing proposals though. If we had @Tuple, then we wouldn't need the other syntax
<alexnask>
Really this is a proposal for @Type-like function but just for tuples since afaict the plan is not to be able to generate arbitrary structs and unions with it
<fengb>
Hmm... but then we wouldn't be allowed to define methods on it
Akuli has quit [Quit: Leaving]
<alexnask>
I don't see what the issue is, you can already use @Type to generate types that have another syntax
<alexnask>
This is just a @Type/@reify-lite proposal specifically for tuples since structs are not planned
<fengb>
I think this makes more sense to hook into @Type directly than a different function (since we just removed @Int)
<alexnask>
I think the usecase is worth it, you cannot create non-generic functions that take argument packs of comptime calculated types
<alexnask>
fengb, I kind of agree but I personally think it would be inconsistent to only allow @Type to generate from TypeInfo.Struct when is_tuple = true
<alexnask>
I don't see why you couldn't generate any arbitrary struct at that point. Anyway I'm not hellbent on this feature, my workaround is good enough for now and I would even prefer @Type for arbitrary container types but that's just me
<fengb>
I dunno. I just want any way to generate a tuple type atm :P
<alexnask>
Sure, I agree your proposal makes sense as well
<fengb>
But realistically, I need a packed tuple, so I'm not sure I can use @Tuple. But it feels like 2 ways to skin a cat
<alexnask>
We just want different levels of generation ;)
<fengb>
Can you comment? I don't know anything about Windows... or unicode >_>
<alexnask>
While a 100% correct implementation would support Unicode I think it's fine to only check ASCII, idk
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
<fengb>
Well now it's definitely buggy because it just reinterprets the []u16 as []u8 ascii :P
<fengb>
Unicode is hard :(
<BaroqueLarouche>
it is
<fengb>
Wow, ascii.toUpper and toLower are pretty neat
<fengb>
I almost feel like it's overengineered since I can't figure it out :D
<BaroqueLarouche>
The worst part of Unicode for me is CJK handling: basically some characters that have the same meaning are now draw differently between Tradional, Simplied, Korean and Japanese but they are mapped to the same codepoint
<nepugia>
ascii to upper and to lower are usually just a specific ofset if the char is within a range :P
<nepugia>
for most implementations
<fengb>
Right that's how I've always coded it. This uses a bitmask from a generated lookup table
<nepugia>
BaroqueLarouche, yeah, the same code point does pose a problem
<nepugia>
funnily enought the noto cjk fonts have the maximum number of chars allowed in a font, so i cant shake the feeling that they wanted to add more into it
<mq32>
btw, there's also a nice way to convert ascii to a decimal number: "c&0xF" :D
<fengb>
Probably faster since doing a double comparison plus branching is potentially slow...
<fengb>
Although I'm not sure a lookup table would be faster either >_>. I'm just fascinated by this code heh
<Barabas>
How do I do this? `const aligned_string : []align(4) const u8 = "my amazing string";`
<Barabas>
With this I get: `error: expected type '[]align(4) const u8', found '*const [17:0]u8'`
<fengb>
This "works" but probably isn't guaranteed: `const aligned_string = @alignCast(4, "my amazing string");`
<alexnask>
Casting to a higher alignment is a bad idea
<fengb>
Hmm, not sure how you align a literal
<alexnask>
Which is why this is not coerced
<fengb>
Yes but he just wants the literal to be aligned. It should be possible
<Barabas>
Probably it's not currently...
<fengb>
I'm pretty sure alignCast will "just work" in x86... so nobody cares about other architectures right? :P
<Barabas>
right =D
<Barabas>
how do I even make an aligned array?
<fengb>
var foo: [N]u8 align(4)
<Barabas>
hm
<fengb>
So you could manually carve out the alignment, but it feels a little kludgy
marmotini_ has quit [Remote host closed the connection]
<tdeo>
in the "Single Threaded Builds" section of the documentation, it says "The overhead of Async Functions becomes equivalent to function call overhead," does this mean that you can't use the async features in single threaded mode, or is it referring to the integration in the standard library?
<fengb>
I believe the compiler would merge any consecutive async-await semantics back into a normal function
<fengb>
But if you manually split async and await into different locations with manual suspend/resume handling, it actually work
<fengb>
Oh there's some atomic locking mechanism that gets removed upon single threaded too
<alexnask>
Yeah that's about it on the compiler side
<tdeo>
atomic locking in the standard library part or the language part?
<tdeo>
i think i see how it could enable more inlining/similar yeah
<alexnask>
On the language part
klltkr has quit [Read error: Connection reset by peer]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]