mrkishi has quit [Read error: Connection reset by peer]
mrkishi has joined #zig
marmotini_ has quit [Ping timeout: 248 seconds]
FireFox317 has joined #zig
<FireFox317>
I'm trying to do some freestanding arm programming with zig and I want to use mem.set to zero the bss. I have two pointers (extern var _sbss) to the end and the beginning. However I can't use mem.set because it is telling me: 'slice of non-array type'. How do I go from 2 pointers to an array?
<FireFox317>
I could use @memset as i've seen in andrewrks clashOs, but this only copies bytes and I would like to copy words, because everything is aligned correctly
marijnfs has quit [Quit: WeeChat 2.4]
<SamTebbs33>
FireFox317: I have done something like this before, let me dig an example out
<SamTebbs33>
Is _sbss defined in your linker script?
FireFox317 has quit [Quit: Page closed]
FireFox317 has joined #zig
<FireFox317>
SamTebbs33: Yes I defined the signals in the linker script and I can access them in my zig code too. But I think the problem is that the mem.set wants an array and i only have those pointers.
<SamTebbs33>
FireFox317: Replace FIXED_ALLOC_SIZE with the difference between the start and end of bss as that will give the desired length
FireFox317 has joined #zig
<FireFox317>
SamTebbs33: Thank you for the reference. I'm gonna try to figure it out.
<SamTebbs33>
FireFox317: sure, no problem
marijnfs has joined #zig
<FireFox317>
I also noticed that if I include the @memset in the code it includes a whole lot of extra symbols like std.math stuff and __div etc. Just by using @memset.
<FireFox317>
I went from 310 to 14 symbols by just commenting out the @memset function. :O
<SamTebbs33>
oh wow :O that must be something that can be optimised
<FireFox317>
and by disassembling the main function it shows that it only calls __aeabi_memclr to do the @memset
<FireFox317>
Should I make an github issue for that?
<SamTebbs33>
FireFox317: If all the other symbols are brought in but never used then I'd say there's a bug so an issue is probably a good idea
<SamTebbs33>
FireFox317: oh good, thanks for the link
Akuli has joined #zig
halosghost has joined #zig
<tgschultz>
Re: yesterday's brief discussion on Jai and Odin. I actually tried Odin before Zig when looking for a C replacement. Avoiding badmouthing other languages here, I'll say that onething that helped win me over with Zig was that even though the stdlib lacked documentation the language itself didn't and that meant I could dive in and start using it for real things right away, not just in some nebulous future.
<halosghost>
is Jai even evailable yet?
<halosghost>
available* even
<halosghost>
it's one of the ones I've been meaning to look into
<halosghost>
but every time I've looked in the past, there's been no compiler
<tgschultz>
no. It exists only within Thekla right now
<halosghost>
yeah
<halosghost>
that's kind of what I thought
<halosghost>
if it ever actually gets released (and runs on linux), I'll definitely consider it
<halosghost>
but it has overloading now
<halosghost>
which is a bit disqualifying for me
<tgschultz>
there are several features of Jai that I think are not what I want in a language.
<halosghost>
for me as well
<halosghost>
I will say thought that SOA/AOS is kind of amazing
<tgschultz>
that isn't even in the language anymore as I understand it
<tgschultz>
he keeps mentioning a feature that'll replace it that's "much better", but it remains a mystery to everyone outside of Thekla.
<halosghost>
wat
<halosghost>
SOA/AOS was amazing
<halosghost>
if it's not there anymore, that'd be a tragedy
<halosghost>
I'll be impressed if something else really is better
<halosghost>
but I'm surprised
<tgschultz>
hmm...mentioning SOA/AOS got me thinking... I can probably make a pseudo-struct in zig that does that.
<halosghost>
DEWIT
<halosghost>
I would adore that functionality in every other language
<halosghost>
I need to get more into zig, but my personal projects are already taking so much of my time that I haven't had the energy to really dive in
<halosghost>
(part of the problem is that the things I want to write tend to use crazy C libraries like ncurses :P)
fengb has joined #zig
marmotini_ has joined #zig
SimonNa has joined #zig
marmotini has quit [Ping timeout: 244 seconds]
wilsonk has joined #zig
wilsonk|3 has quit [Ping timeout: 248 seconds]
marmotini has joined #zig
marmotini_ has quit [Ping timeout: 245 seconds]
<fengb>
Resurrecting the thread: one of the things I like about Zig's philosophy (and Go and Python) is it tries to be consistent and get out of the way
<fengb>
Every language that emphasizes "joy" or what not ends up being quirky around the edges
<scientes>
yes
<tgschultz>
Zig generally aligns with my personal philosophy of "simple is usually better, even if it is harder".
<scientes>
that's why languages have functions...
<scientes>
but zig is quite a bit more powerful than C
<scientes>
except for the bugs that is
<fengb>
tgschultz: even that can get complicated. People also love Clojure because it's "simple"
<companion_cube>
how is clojure not simple? :)
<tgschultz>
what I mean by simplicity is the ability to create an accurate mental model of it with relatively little effort. Simple: files and folders, Complicated: relational databases.
<fengb>
For 1, I've never understood lambda calculus as the "base" of programming when bare metal is all imperative
marmotini_ has joined #zig
<scientes>
it just means they think that way
<companion_cube>
it's a convenient high level calculus, is all
<tgschultz>
surely there are cases where more complex solutions are necessary, but in my estimation a whole lot of our industry fetishises complexity.
<scientes>
regular expressions (actual ones) are also important, but not integrated very well
<scientes>
although zig wants to do comptime compilation and evaluation of regular expressions
<fengb>
But also, the details of the core libs are really complicated. Lists are n blocks of memory chained by linked lists
<fengb>
Anyway, I like Clojure. I just don't really think it's that simple, especially when compared with some of the other Lisps
marmotini has quit [Ping timeout: 248 seconds]
<companion_cube>
ok, I'd agree scheme is simpler… except for call/cc 😁
<tgschultz>
godbolt's url shortner seems to be busted.
<andrewrk>
SOA/AOS is a recognized valid use case of the zig project and further recognized as not currently solved
<andrewrk>
argh did the macos CI break? macos is such a moving target
avoidr has joined #zig
* scientes
had to look that up. Yeah SOA/AOS looks like great stuff
<scientes>
also the lack of struct order guarantees mean it could be better than C, with much less effort on the programmer's part
<scientes>
ohh i see
<scientes>
that allows you to use libmvec too
wilsonk|2 has joined #zig
marmotini_ has quit [Remote host closed the connection]
<mikdusan>
stupid question: in pipelines.yml `vmImage: 'macOS 10.13'` -- docs examples show 'macOS-10.13' or 'macOS-10.14' as choices
<andrewrk>
we should probably choose 10.14
<mikdusan>
that llvm binary indicates it was built on 10.14
<mikdusan>
maybe in macos script add a few lines like: `sw_vers`, and `ld -v` . i suspect ld *might* have been upgraded because Apple released command-line-tools for Xcode 11 beta
<mikdusan>
(but i think that's a 10.14 thing.. so maybe not relevent to this failure)
<halosghost>
tgschultz: fascinating
<halosghost>
andrewrk: I'm really happy to hear zig is interested in solving SOA/AOS
mrkishi has quit [Ping timeout: 257 seconds]
oats has joined #zig
<halosghost>
andrewrk: any chance there's an open issue about SOA/AOS?
<halosghost>
I see a couple of related issues (#2255, #2078), but not a specific umbrella issue
<halosghost>
(also, #383)
Ichorio has joined #zig
Ichorio has quit [Read error: Connection reset by peer]
<andrewrk>
halosghost: feel free to open a new one specifically for the use case. I think there is not a dedicated issue for it yet
<andrewrk>
I'll leave it open until zig has an official answer for how to do that use case
<halosghost>
sounds fun
<halosghost>
I will open one (probably tonight), and try to go into as much detail as possible
<halosghost>
tgschultz: with your permission, I would include the code you threw together as a basic example of a prototype
<Wolf480pl>
Hello. I just learned about zig's error sets, and I was wondering: how does it handle the differences of the possible errors between OSes?
<Wolf480pl>
For example, on Linux close(2) can result in ENOSPC, but POSIX doesn't mention it, so there are probably systems where it can't happen. Is it possible to write a zig wrapper for a C function in such a way, that even on system on which close can't result in ENOSPC, ENOSPC will still be in the wrapper's error set, so that the error set stays consistent across systems?
<Frank-Lesser>
Hi all
oats has left #zig ["WeeChat 2.4"]
<Frank-Lesser>
I was trying to solve the compilation issue & got a bit further - just hanging on debug.zig no member called 'CONSOLE_SCREEN_BUFFER_INFO'
<emekankurumeh[m]>
Wolf480pl: you could just define an error set that contains all possible errors and define the function as one that returns errors from that set.
<Wolf480pl>
so I can declare errors that the current implementation does not return? Nice.
<emekankurumeh[m]>
Frank-Lesser: what compilation issue?
<Frank-Lesser>
I was trying to compile hello_windows.zig with the latest ( andrew know the issue )
<Frank-Lesser>
it is connected with hefty changes
<Frank-Lesser>
it compiles with zig 5d347c07 ( before usenamespace )
<Frank-Lesser>
had to add a bunch of constants back to std/os/windows.zig
<Frank-Lesser>
like DWORD / HANDLE etc
<emekankurumeh[m]>
i think that's due to an error with how imports work
THFKA4 has quit [Quit: WeeChat 2.4]
<Frank-Lesser>
hmm no IMO the files have changes - just missing constants
<emekankurumeh[m]>
the constants are imported but due to an issue with imports the constants aren't present
<emekankurumeh[m]>
when i try to build/run hello_window.zig the first error i get is ` error: import of file outside package path: 'windows/bits.zig'` which *should* be in the package path.
<emekankurumeh[m]>
that's where those missing constants are defined
<Frank-Lesser>
yep , just looking
mrkishi has joined #zig
<Frank-Lesser>
hmm yes indeed contains missing things but still errors
<Frank-Lesser>
I get this one now ...debug.zig:549:30: error: container 'std.os.windows' has no member called 'CONSOLE_SCREEN_BUFFER_INFO'
<Frank-Lesser>
but CONSOLE_SCREEN_BUFFER_INFO is in bits.zig
<emekankurumeh[m]>
hence the error with the import system
halosghost has quit [Quit: WeeChat 2.4]
<Frank-Lesser>
hmm there are 2 bits.zig
alexander92 has joined #zig
<alexander92>
hey guys
<alexander92>
i am a nim guy, but also a big langdev hobby enthusiast
avoidr has quit [Quit: leaving]
<alexander92>
i wondered if there is a nim(or e.g. rust/crystal) vs zig comparison, or people that used both
<alexander92>
three things i am interested in: metaprogramming, interesting type system guarantees, osdev applicability(ease to write very low level cod)
<emekankurumeh[m]>
i've used all 4 to varying degrees so feel free to ask an questions and i'll do my best to answer
<alexander92>
ok!
<alexander92>
so does zig have some metaprogramming support?
<alexander92>
i know it has compile time fn-s (?)
<alexander92>
but does it have any way to affect somehow ast-s or to at least analyze inline annotations
<emekankurumeh[m]>
it's not well documented but zig has pretty strong metaprogramming support
<alexander92>
hm, so what subset of zig can you run on ct
dimenus has joined #zig
dimenus has quit [Remote host closed the connection]
<emekankurumeh[m]>
you can't run any extern functions at conpile time, some casts don't work but most of those are bugs
<emekankurumeh[m]>
for anything else that zig can't do at comptime it will emit an error
<alexander92>
nice
<alexander92>
so how does it do it? nim uses its own interpreter, i guess zig does something similar
<alexander92>
but this is still not touching the syntax right
<alexander92>
so is zig's goal to not surprise the user (like go), not letting macros affect stuff
<emekankurumeh[m]>
in zig you don't have access to the AST like in nim, and you don't have anything like procedural macros or templates but you full access to all type information and you can see `std/meta.zig` for some examples
<alexander92>
or is it more like rust/nim: having full macros
<emekankurumeh[m]>
correct
<alexander92>
ok
<alexander92>
like that
<alexander92>
i am a big macro fan, but its good to have both options as langs
<alexander92>
otherwise does it have some type stuff which is not related to memory, e.g. typeclass-like things
<alexander92>
dependent-type-like stuff, or is the type system mostly
<alexander92>
focused on making low level code work well
<alexander92>
and how easy is to debug, basically to map zig to the asm code(or equivalent c)/step around, i am working on some nim/c debug tools, so very interested in t
<emekankurumeh[m]>
in zig it's pretty easy to understand what asm code the compiler will produce, and debuggers like lldb and gdb work with zig executables
alexander92 is now known as rename
rename is now known as alexander92
<alexander92>
ok, hm, also how fast is compile time
<alexander92>
relatively
<alexander92>
e.g. if hypothetically
<alexander92>
the whole zig compiler is in zig
<alexander92>
how much would it take to rebuild itself on a modern laptop
<alexander92>
this is a very unscientific question ugh
Summertime has quit [Quit: Sunsetting.]
<emekankurumeh[m]>
the self-hosted zig compiler currently doesn't compile as it's waiting on a couple of language changes, but my zig projects always compiler relatively fast, i.e. less that 5 seconds
<emekankurumeh[m]>
though the amount of comptime code present might slow things down
Ichorio has quit [Ping timeout: 248 seconds]
<alexander92>
yes similar to nim ast code
Summertime has joined #zig
FireFox317 has joined #zig
<alexander92>
how is it limited: in nim usually you have a limit on the amount of instructions
<alexander92>
the vm will run on ct
<alexander92>
(compil time)
<FireFox317>
Don't forget the awesome cache system that Zig is using to speed up compilation time
<alexander92>
so after the first compile
<alexander92>
it runs much faster
<alexander92>
?
<alexander92>
can it parallelize compilation somehow
<alexander92>
does it run compilation for each "module" indepenendently (relatively)
<alexander92>
or does it run each pass for the whole codebase and then the next one
<emekankurumeh[m]>
in zig you can use `@setEvalBranchQuota` to change the maximum number of backwards branches that compile-time code execution can use before giving up and making a compile error.
<emekankurumeh[m]>
and that works on a per-block basis
<emekankurumeh[m]>
zig also caches comptime code if i remember correctly
<alexander92>
hmm
<Frank-Lesser>
ok, bye already the next day & need to get up early , hope the import system get fixed
<emekankurumeh[m]>
zig compiles all the code into a single object file for link time optimizations
<alexander92>
ok, but what i wondered is
st4ll1 has joined #zig
<alexander92>
how easy is for zig to reuse previous artifacts
<alexander92>
e.g. if it caches IR for certain modules
<emekankurumeh[m]>
see you
<alexander92>
or just ast
<alexander92>
night
<alexander92>
!
<Frank-Lesser>
what I did I renamed bits to bitsw ( the deeper one ) still getting errprs
<emekankurumeh[m]>
it caches all build artifacts as i can tell.
<emekankurumeh[m]>
the higher level bits just re-exports the lower level one
<Frank-Lesser>
the orig doesnt work ( getting the compile errors )
<Frank-Lesser>
which orig std ? I used the latest one
<Frank-Lesser>
my first error using your hello_windows.zig
<Frank-Lesser>
build-release\lib\zig\std\os\windows.zig:839:13: error: use of undeclared identifier 'FORMAT_MESSAGE_FROM_SYSTEM'
<emekankurumeh[m]>
i meant with no changes
<emekankurumeh[m]>
hmm, it works no problem for me on master
<Frank-Lesser>
downloaded the latest & used your gist hello_world.zig
alexander92 has quit [Ping timeout: 245 seconds]
<andrewrk>
emekankurumeh[m], the self-hosted zig compiler does compile, it's part of the test suite
<andrewrk>
it takes about 10 seconds to build
<andrewrk>
that's stage1 building stage2 though. stage2 can only build hello world and has a lot more incremental build features planned
gamester has joined #zig
<emekankurumeh[m]>
it shouldn't be too much work to get that compiling on mingw64 then
<Frank-Lesser>
this is what I getwith latest C:\Program Files\Zig\lib\zig\std\os\windows.zig:21:20: error: import of file outside package path: 'windows/bits.zig'
<emekankurumeh[m]>
andrewrk: is azure ci for open source projects free?
<emekankurumeh[m]>
Frank-Lesser: that was the error i was describing earlier
<emekankurumeh[m]>
it's because the package path is changing suddenly behind the scenes. if you go into ir.cpp and have it print out the full paths when it's resolving a package for some reason when importing `windows/bits.zig` it looks in the cwd but only for that file
<Frank-Lesser>
hmm would't it be a work around just to rename one of the bits.zig ?
I_Right_I has joined #zig
<emekankurumeh[m]>
i don't think so, i tried doing that a while ago and it didn't seem to work
<Frank-Lesser>
ok
<emekankurumeh[m]>
this patch should show when that happens: http://ix.io/1L77
<emekankurumeh[m]>
when you namespace the import the cwd is nowhere to be found in the output
<Frank-Lesser>
ok, thx- I shall try tomorrow morning