frmdstryr has left #zig ["Konversation terminated!"]
<andrewrk>
I do wonder what in zig source code is eventually calling that function
<andrewrk>
I think it's probably the call to LLVMDumpModule
<andrewrk>
which we want to be able to do, even for release llvm + debug zig. so I think the solution would probably be, in the zig-bootstrap build script -DLLVM_ENABLE_DUMP=ON
<FireFox317>
okay i will try if that fixes it
b_jonas has joined #zig
kristoff_it2 has joined #zig
osa1_ has joined #zig
osa1 has quit [Ping timeout: 240 seconds]
<ifreund>
hmm, I wonder how hard it would be to write firmware for my new avr-based keyboard in zig
<ifreund>
I mean qmk works fine but it is pretty macro heavy C code
kristoff_it1 has quit [Ping timeout: 260 seconds]
kristoff_it1 has joined #zig
<teratorn>
im returning !MyStruct from an fn... but when I return self.err, which is an enum of error values, it says I have to return MyStruct
<teratorn>
i want error union type
<g-w1>
return error.Makeitup
<g-w1>
an error set is not same as enum
kristoff_it2 has quit [Ping timeout: 260 seconds]
kristoff_it has joined #zig
ur5us_ has quit [Ping timeout: 264 seconds]
kristoff_it1 has quit [Ping timeout: 260 seconds]
radgeRayden has quit [Ping timeout: 244 seconds]
<FireFox317>
andrewrk, Nice! That fixed it indeed
<andrewrk>
beautiful, and now you can build zig from source without MSVC
<FireFox317>
exactly!
<FireFox317>
still have to see if it actually runs, but i got an exe
<FireFox317>
andrewrk, do you want this flag in the zig-bootstrap repo too? Because it is only needed when building zig in debug mode, which currently the script is not doing
radgeRayden has joined #zig
<andrewrk>
hmm not sure. the zig-bootstrap build script is kinda like "executable documentation" I'm not sure how to factor this discovery into it
radgeRayden has quit [Remote host closed the connection]
<FireFox317>
Hmm maybe we can add it to the ziglang wiki on how to build zig on windows
ur5us_ has joined #zig
<FireFox317>
andrewrk, #7043 was needed for zig-bootstrap to work
solaire has quit [Quit: WeeChat 2.9]
<FireFox317>
will try tomorrow to run it on windows. goodnight
FireFox317 has quit [Quit: Leaving]
a92 has joined #zig
<g-w1>
what is the point of .sema_failure_retryable in stage2? is seems like in every use case it is always the same as .sema_failure
cole-h has quit [Ping timeout: 260 seconds]
kristoff_it has quit [Ping timeout: 260 seconds]
<andrewrk>
g-w1, it's for stuff like "out of disk space" where you could report an error to a user and then expect to be able to retry it and get a different result
<teratorn>
.\amp.zig:70:40: error: expected type 'AmpBox', found 'ParseError'
<teratorn>
return self.err;
<teratorn>
i thought this would make it return an error union?
<g-w1>
errors in zig arent enums
<g-w1>
you cuold make return type union(enum) { err: ParserError, amp_box: AmpBox}
<g-w1>
this would work
<pixelherodev>
ParserError should be `const ParserError = error {`
<pixelherodev>
Then you can do `ParserError!AmpBox` for the return type
<pixelherodev>
g-w1: that's a *union*, not an *error union*
<teratorn>
nice i will try thx all
<g-w1>
I know, if they were trying to return an enum as an error, *not an error set* then a union would work.
<teratorn>
can error unions be exposed to C client?
<pixelherodev>
I don't think so
<pixelherodev>
If this is for a C API, then g-w1's suggestion is - ah wait no, the union tag isn't accessible in C either
CodeSpelunker has quit [Quit: CodeSpelunker]
<pixelherodev>
If the goal is to have an interface usable in C, then either a) define bindings and let inlining / LTO fix the performance cost, or b) redesign the interface to only use `extern` types
<pixelherodev>
e.g. `extern struct` with a tag and a union should be usable for a C interface, I think
lucid_0x80 has joined #zig
lucid_0x80 has quit [Remote host closed the connection]
a92 has quit [Quit: My presence will now cease]
xackus has joined #zig
xackus_ has quit [Ping timeout: 256 seconds]
lucid_0x80 has joined #zig
mmohammadi9812 has quit [Ping timeout: 264 seconds]
mmohammadi9812 has joined #zig
xackus_ has joined #zig
xackus has quit [Ping timeout: 256 seconds]
<teratorn>
there is no typedef in zig?
<g-w1>
const NewType = OldType;
<g-w1>
it is just const :P
<teratorn>
cool!
<g-w1>
why are some stage2 issues being marked as 0.7.1 milestone?
<teratorn>
.\amp.zig:105:25: error: expected type 'ParseError', found '@typeInfo(@typeInfo(@TypeOf(std.array_list.ArrayListAligned(u8,null).appendSlice)).Fn.return_type.?).ErrorUnion.error_set'
<lunamn>
teratorn: you can either use inferred error sets or merge error sets with the || operator
<lunamn>
g-w1: ah i see. no idea then
<g-w1>
teratorn, you could add OutOfMemory to the ParserError or do this: merge error sets pub fn decode_box(self: *AmpDecoder, bytes: [*]u8, size: usize) (ParseError || std.mem.Allocator.Error)!AmpBox {
<fengb>
Some parts of the current compiler are actually written in Zig
<fengb>
Bootstrapping creates a zig0, which is the only C++ code, and we use that to build some of the Zig code to get the full stage1 compiler
<andrewrk>
g-w1, fwiw the stage2 label means it's more likely to get worked on sooner (at least by me)
<andrewrk>
thanks for reporting #6976 btw
<g-w1>
np
<g-w1>
I see your fix (had the exact same idea), but does it not fix the problem that the compiler will output an empty executable when the analysis fails?
<andrewrk>
that's intentional
<g-w1>
is it so that you can do incrimental compilation? if so cool!
<andrewrk>
yep
<andrewrk>
zig will make progress on an executable even when the compilation fails
<g-w1>
thats soo cool
<andrewrk>
the only thing remaining for that to be true is serialization of zig's incremental compilation metadata
<andrewrk>
currently that information only exists in memory
<g-w1>
I assume that will go hand in hand with a language server?
<andrewrk>
oh hell yeah. this whole architecture is designed first for that use case, and *secondarily* for CLI
<andrewrk>
hence the (now fixed) bug where the CLI did the wrong thing
a_chou has joined #zig
<teratorn>
g-w1, ok excellent, im glad merging them is easy!
ur5us_ has quit [Ping timeout: 260 seconds]
adamkowalski has joined #zig
<adamkowalski>
what's the proper way to use hash map when your key "may" be a string or something else?
<adamkowalski>
normally I use an autohashmap
<adamkowalski>
but if I have a string I use stringhashmap
<adamkowalski>
but if I want to be generic over the type I'm not sure what to do
<adamkowalski>
and what do you use if it's a struct where the fields may be strings?
<adamkowalski>
is there a way to control the hash function being used on a per struct basis?
adamkowalski has left #zig ["ERC (IRC client for Emacs 28.0.50)"]
lltt has quit [Ping timeout: 265 seconds]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
<teratorn>
how do you declare an []u8 array literal?
<teratorn>
well , i need to define some static binary data and get a [*]u8 to it
<teratorn>
.\amp.zig:209:28: error: expected type '[*]u8', found '*const [26]u8'
<teratorn>
var b = dec.decode_box(b1, b1.count).?;
<teratorn>
^
<daurnimator>
[*]u8 is not const
<daurnimator>
i.e. it can't take static binary data.
<daurnimator>
if it was `[*]const u8` it would coerce.
<teratorn>
is there a way to get the size of such an array literal?
<teratorn>
like sizeof in C?
<daurnimator>
.len
<daurnimator>
but also @sizeOf
<teratorn>
ah
<daurnimator>
but only if you have the actual array literal
<daurnimator>
not a pointer to the array literal
<daurnimator>
which in C is a blurred line
waleee-cl has quit [Quit: Connection closed for inactivity]
earnestly has quit [Ping timeout: 256 seconds]
ask6155 has quit [Ping timeout: 240 seconds]
nixel has joined #zig
nixel has quit [Changing host]
nixel has joined #zig
osa1 has joined #zig
tsujp has quit [Ping timeout: 264 seconds]
tsujp has joined #zig
a_chou has quit [Quit: a_chou]
lucid_0x80 has quit [Ping timeout: 256 seconds]
<teratorn>
having trouble understand how to store HashMaps in an ArrayList... I seem to be adding keys, but in the end it prints that the map has 0 keys... http://0x0.st/in_7.zig
<nixel>
teratorn: approximately where are you modifying the map?
<nixel>
It's hard to help when most of the pasted file is irrelevant to the issue
<teratorn>
lines 80,103,162
<nixel>
(oh, and since this probably isn't obvious: hi, this is pixelherodev. I'm just playing with ircrc on 9front :)
lltt has joined #zig
mmohammadi9812 has quit [Ping timeout: 240 seconds]
mmohammadi9812 has joined #zig
<teratorn>
the map im modifying is in an arraylist in a struct.... i add keys and values, then i remove the map and return it at one point
<teratorn>
but then it has 0 keys
<daurnimator>
teratorn: I think HashMap doesn't make a copy of the key/value you pass; if you're passing in pointers (which I think you are?) then you need to make sure they live on.
<teratorn>
oh i want copies
<daurnimator>
teratorn: also note std.log for logging instead of the stdout prints you have
<daurnimator>
and std.debug.print for the printf based debugging I also see in there
nixel has quit [Quit: Leaving...]
<teratorn>
daurnimator, so how am i storing pointers? how do i change it to store the byte buffers themselves?
<daurnimator>
teratorn: you should think about lifetime of the data -> as long as they exist in the hashmap, you're going to want your keys/values to live.
<daurnimator>
teratorn: which may mean you e.g. `mem.dupe()` your keys
<daurnimator>
teratorn: oh also, for tests use `testing.allocator`
<teratorn>
how could the count go to 0 if dangling pointers remain in the map though?
<daurnimator>
I didn't get to that yet; saw all the other issues first
<daurnimator>
and now I have to head out
<teratorn>
ah, thanks anyway
decentpenguin has quit [Read error: Connection reset by peer]
lucid_0x80 has joined #zig
decentpenguin has joined #zig
ask6155 has joined #zig
xackus_ has quit [Ping timeout: 260 seconds]
<novaskell>
you're writing over it somewhere
lucid_0x80 has quit [Ping timeout: 256 seconds]
<novaskell>
so by the time you finish reading one pair it's gone
cole-h has joined #zig
<teratorn>
oh i think i get it
<teratorn>
i init a new hashmap on the initial state of the state machine. i need to keep the exiting one if it exists
<teratorn>
novaskell, good call thank you!
<teratorn>
wonderful help here today
<teratorn>
zig is exceeding my expectations
<novaskell>
note, I'd write an iterator over length prefixed items instead of a parser in one go then write something like this `var it : Iterator = .{ .bytes = b1 }; while (it.next()) |kv| try map.put(kv.key, kv.value);` since the format is simple
<novaskell>
since then you just handle one pair at a time
osa1 has quit [Quit: osa1]
osa1 has joined #zig
osa1_ has quit [Quit: osa1_]
kristoff_it has joined #zig
osa1_ has joined #zig
<teratorn>
yeah its amp-protocol.net nice and simple :-)
<teratorn>
making a zig C API lib and hoping to wrap it for many languages with SWIG perhaps, and compile for JS via WASM
<pixelherodev>
the AMP protocol is Google's garbageware, right?
<Kena>
thank you iksuh. But was it a single precision floating point explanation or floating point in general?
<daurnimator>
Kena: "Float literals have type comptime_float which is guaranteed to have the same precision and operations of the largest other floating point type, which is f128. "
<alexnask[m]>
This applies to all floating point numbers
<alexnask[m]>
floating point types*
<Kena>
Thank you both.
<Kena>
But that doesn't tell us is f128 have single or double precision lol.
<ikskuh>
f128 have quadruple precision
<ikskuh>
double = f64
<ikskuh>
single = f32
<ikskuh>
half = f16
<ikskuh>
quadruple = f128
<Kena>
yes thank you buddy, I just saw the quad precision on wikipedia. I'll complete my zig memorandum, thank you for your patience.
<Kena>
mister Xavier
<teratorn>
how do you do a for loop or foreach over a range of ints?
<Kena>
you assign your range of ints in a variable and iterate over it, then capture the payload and process it with the block
<ikskuh>
var i: usize = start; while(i < end) : (i += 1) { }
<alexnask[m]>
`var a: usize = ...; while (a < b) : (a += step) { }`
glamhoth has joined #zig
<ifreund>
'oy
<glamhoth>
o/
<alexnask[m]>
allô
yello has joined #zig
yello has quit [Remote host closed the connection]
<g-w1>
in stage2, an error set is represented as a *Decl. will the items in the error set be represented as Decl.scope.cast(Scope.Container)? type.zig:3111 is where im looking for the items in the error set
Miaourt has joined #zig
<g-w1>
this is the comment for container, so i was wondering if it also applies to error sets? : /// struct, enum or union, every .file contains one of these.
sord937 has joined #zig
<g-w1>
ah I think I have to cast it to Scope.LocalVal then cast that to zir.inst.ErrorSet then use the positionals field on that
CommunistWolf is now known as slime-mold
slime-mold is now known as CommunistWolf
kristoff_it has quit [Ping timeout: 264 seconds]
<g-w1>
ok so to find the error set I had to do this: var error_set_a = a.cast(Payload.ErrorSet).decl.scope.cast(Module.Scope.LocalVal).inst.cast(zir.Inst.ErrorSet).positionals;
<g-w1>
this seems kinda wrong, is it?
<Kena>
Another noobie question, please why does `expect(std.math.maxInt(u10) == 1_000_000);` return a success? How can 1023 considered equal to 1 million?
<Kena>
I must miss something because all expect return success in other snippets of code even with absurd values.
<g-w1>
are you doing zig test or zig run
<Kena>
zig test
<Kena>
How can I now if a instruction is not executed?
<Kena>
s/now/know
<g-w1>
add @compilerError
<Kena>
const std = @import("std");test "expect testing" { if (std.math.maxInt(u10) == 1_000_000) @compileError("The failed test has been correcly executed.");}
<Kena>
`zig test my_file.zig` passes.
<Kena>
that mean I do not test anything since I began reading ziglearn.org :/
<g-w1>
even with panic it doesn't work. interesting
<Kena>
If passes also with comptime block I do not understand.
<Kena>
const std = _whitelogger "expect testing" { comptime { if (std.math.maxInt(u10) == 1_000_000) @compileError("The failed test has been correcly executed."); }}
<Kena>
const std = import("std); test "expect testing" { comptime { if (std.math.maxInt(u10) == 1_000_000) @compileError("The failed test has been correcly executed."); }}
<Kena>
is it a bug related to Windows or did I miss a thing?
<alexnask[m]>
The if with the compileError passes which is a bug for sure
<RodBiren>
Hello everybody, new to zig and I made a total of one extremely minor doc contribution, so I am still learning. I just had a question about how to properly declare an extern "c" struct.
<ikskuh>
const Struct =extern struct { };
<RodBiren>
Oh, That makes a lot more sense than "extern "c" const Point = struct {}"
<RodBiren>
Thank you
<Kena>
I submitted the bug on github alexnask[m] #7050
<dutchie>
i think that's actually correct behaviour, on reflection
<dutchie>
the compiler can at comptime see that those are unreachable and ignore them
<alexnask[m]>
oh waiot im dumg
<Kena>
after reflexion or compile-time reflection you mean?
<dutchie>
it's just a more complicated way of writing `if (false) { @compileError("") }`
<alexnask[m]>
dumb*, should be != instead of == >.>
<g-w1>
were all dumb
<Kena>
Allright, so I can safely remove the issue?
<Kena>
From a performance point of view, does `import("std")` slow down the software by importing all even not used standard API?
<Kena>
Hello LemonGuy
<fengb>
No, the compiler only does rudimentary parsing on import by default because it's lazy
<scientes>
Kena, zig is statically linked, like fengb just said
<scientes>
oh yeah, also the lazy parsing thing
<scientes>
so it doesn't even really read that code
<scientes>
only the test suite does that
<fengb>
It takes the hit on file access/read, but it only does real work once you reference the variables you need
<Kena>
Allright! But static and dynamic linking aren't explained anywhere, except the former one happens at link-time. But I don't know/understand what does it involves/implies/offers.
<scientes>
linking really is a different issue
<fengb>
So doing something like `@import("std").debug.warn("foo", .{})` means it'll only import std.zig and std/debug.zig
<scientes>
sorry for confusing you
<Kena>
lol
<Kena>
thanks guys
<fengb>
None of the other files are pulled in or analyzed because Zig is really lazy
<scientes>
lazy zig is a awesome feature
<Kena>
Allright, the lazy evaluation mechanism I understand.
<fengb>
(Well I guess it also imports os, io, and fmt due to those dependencies)
<fengb>
But it doesn't pull in all of std
<Kena>
yes but lazy evaluation do not raise errors compilation when a ill-defined branch is considered dead, which can introduce regression much later if the branching should be altered.
<fengb>
That is true yes
<scientes>
I aspire to be as lazy as zig in my daily life :)
<TheLemonMan>
let's throw away the ziguana and adopt a sloth as mascotte!
<g-w1>
sonic
<TheLemonMan>
sanic
xackus_ has joined #zig
<gonz_>
Are there any packages people would use for HTTP client stuff right now?
<g-w1>
ziget
<dutchie>
i need to solve that problem at some point, though i was half-planning to just use libcurl
<TheLemonMan>
yak shaving ftw
<TheLemonMan>
once the http library is done it's time to tackle the ssl library and so on...
<dutchie>
yeah, currently i have a half-bald libmpv-shaped yak
<g-w1>
is the plan to include a big stdlib? or to reccomend outside libs?
<dutchie>
then i can move onto the https one
frmdstryr has quit [Ping timeout: 264 seconds]
<g-w1>
can someone else confirm that -femit-zir is broken in stage1 before i report an error?
<pixelherodev>
It's not
<pixelherodev>
g-w1: ZIR is a stage2 detail
<pixelherodev>
emit-zir makes no sense in stage1
<g-w1>
there is no stage1 ir?
<pixelherodev>
There is. emit-ir
<pixelherodev>
There is no stage1 *ZIR*
<teratorn>
can i run tests with full optimizations?
<pixelherodev>
It has a different IR
<g-w1>
-femit-ir not found
<pixelherodev>
teratorn: yes, but generally harmful
<pixelherodev>
Most of the time the optimizations take more time than the tests would
frmdstryr has joined #zig
<teratorn>
how?
hnOsmium0001 has joined #zig
<pixelherodev>
zig test --release-fast I think?
<s-ol>
hey, anyone know how come a release-small freestanding wasm32 binary with essentially nothing in it is 52k?
<s-ol>
i dont have any toolchain set up on this laptop so I cant inspect the file well, but it seems to contain a bunch of junk math symbols
<teratorn>
hmm, my test case is stuck
<teratorn>
how do i get a stack trace on windows :/ ?
<pixelherodev>
you optimized?
<teratorn>
either way
<pixelherodev>
It might just be hangin - ah
<teratorn>
its hung using no cpu
<teratorn>
but supposed to be in a 1000000 for loop
radgeRayden has joined #zig
tane has joined #zig
Snetry has quit [Quit: left Freenode]
skuzzymiglet has joined #zig
<sergeeeek[m]1>
Is there a reason why expression blocks use a weird break blk; syntax instead of just return?
<sergeeeek[m]1>
Or similar to rust where last expression without a semicolon is a return statement
<g-w1>
it is so that you can have nested blocks
glamhoth has quit [Quit: WeeChat 2.9]
<Kena>
Does someone know the status of a issue related to not priting a result in the absence of a newline character? I've been subject to the same bug accidentally and I do not remember the number's issue.
<g-w1>
this has to due with terminal buffering i think
<Kena>
A bad conversion between CRLF and LF in the text editor you mean?
<g-w1>
when doing std.debug.print("no new line", .{}); what happens?
<Kena>
yes your minimal case do the trick: nothing is printed in stdout.
nvmd has joined #zig
<g-w1>
what terminal are you using. the new windows terminal
<Kena>
This was published somewhere in the netherland of the 1400 issues.
<Kena>
I'm using powershell.
<fengb>
Huh, isn't stderr supposed to flush regardless of terminating newline?
<Kena>
I do not know.
<g-w1>
Kena, when you do "#include <stdio.h> int main() {printf("doesthiswork");}" and compile it does it work
<g-w1>
(this is c)
<Kena>
let me look at the doc 1 second I do not know how to test a .c file
<g-w1>
zig cc :P
<Kena>
lol indeed.
xackus_ has quit [Ping timeout: 240 seconds]
<Kena>
i'm running `zig cc test15.c -lc -target native-native-gnu` . I thought the target was a default value for 0.7.0 but it returned `error: unable to create compilation: WindowsSdkNotFound` so I passed it anyway.
<g-w1>
does zig cc test15.c -o test15 not work?
<Kena>
It's still compilling! (with a warning)
<Kena>
Allright, done. It hasn't returned anything in stdout.
<g-w1>
sounds like a problem with buffering in powershell. when you print the \n it works?
<Kena>
in zig yes, in C I do not know yet.
mmohammadi9812 has quit [Quit: Quit]
Mat5 has joined #zig
<andrewrk>
o/ TheLemonMan
<Kena>
In fact, I didn't run it , I just compiled it. How do you run a C program on Windows?
<andrewrk>
zig run hello.c
<Kena>
thanks, now it tells me `test15.c:1:10: fatal error: 'stdio.h' file not found`
<Kena>
by the way g-w1, `zig cc test15.c -o test15 -lc -target native-native-gnu` produces `error: FileNotFound`
<g-w1>
interesting. well to fix the error with zig run do `zig run test15.c -lc` to link the c standard library
<Kena>
Compiling is a whole new world for me because I was only learning the language's syntax hitherto.
<Mat5>
G'Day. I tried to build the Zig bootstrap sources for version 0.7.0. However this failed for the test suite at linking stage. From the error log, it seems the glib interface is not correctly detected.
<Mat5>
does one know how to fix this?
Kena has quit [Remote host closed the connection]
<andrewrk>
Mat5, which target?
lltt has joined #zig
<Mat5>
native (AMD64, Arch linux)
<andrewrk>
try this triple and cpu instead: native-native-musl native
<andrewrk>
what this does is everything native except use musl to static link libc
<Mat5>
thanks, will post about the result later (build need some time)
<andrewrk>
but an error report would be appreciated for the other one because last I checked, that also worked
<Mat5>
ok
plakband has joined #zig
TheLemonMan has quit [Quit: Lost terminal]
LanceThePants has quit [Read error: Connection reset by peer]
LanceThePants has joined #zig
radgeRayden has quit [Quit: No Ping reply in 180 seconds.]
radgeRayden has joined #zig
cole-h has joined #zig
lroy64[m] has joined #zig
lroy64[m] has left #zig ["User left"]
skuzzymiglet has quit [Read error: Connection reset by peer]
lroy64[m] has joined #zig
<plakband>
Why is this allowed https://pastebin.com/BBMyDNyf ? If neither t0 nor t1 can be comptime, why can I mark t1 - t0 as comptime?
omglasers2 has quit [Read error: Connection reset by peer]
omglasers2 has joined #zig
ur5us_ has joined #zig
knebulae has quit [Read error: Connection reset by peer]
knebulae has joined #zig
<andrewrk>
plakband, I think you found a neat little compiler bug
<plakband>
andrewrk: yay!
<plakband>
Want me to open an issue?
<andrewrk>
yes please
data-man has joined #zig
develonepi3 has joined #zig
<data-man>
Zig in GH topics. Soon. ™
<andrewrk>
data-man, congrats on getting it merged :)
<develonepi3>
andrewrk: Do you think zig has a place in HDL? I am trying to get back into FPGAs. I ask since, I just read that LLVM is being used for HDL.
<andrewrk>
develonepi3, hmm that's a good question that I don't think I am qualified to answer. however I bet some people around here may know the answer
<develonepi3>
andrewrk: They are using C and claim LLVM some features that make it a good choice.
<andrewrk>
do you know which llvm target that corresponds to?
<virgohg_>
If LLVM were migrated to Zig, it would be epic.
<andrewrk>
I don't think that there exists any universe in which that happens
<virgohg_>
If Zig proves itself worthy of migrating to for LLVM, then why not?
<andrewrk>
it's millions of lines of c++
<companion_cube>
it'd be a lot of effort with no clear reward for people doing it
<virgohg_>
Yeah, but the technical debt always accumulates.
<ifreund>
more likely would be a new project with similar scope/goals written in zig
<ifreund>
llvm is too big to port
<g-w1>
maybe factoring out the codegen of the self hosted backend?
<develonepi3>
andrewrk: There is a website "http://www.c-to-verilog.com/". The FPGA is such a hard nut to crack. I have been trying for several years. Now I am looking Transaction Level Verilog TLV. With the purchase of the number 1 & 2 by Intel & AMD something is in the air with FPGAs.
radgeRayden has quit [Quit: No Ping reply in 180 seconds.]
blackbeard420 has quit [Remote host closed the connection]
<andrewrk>
ikskuh, who do you think we have in this channel who would be interested in this topic that develonepi3 is bringing up?
radgeRayden has joined #zig
<ikskuh>
pixelherodev, and me probably. i think either firefox and lemonman also are interested in lowlevel stuff
<ikskuh>
and develonepi3: the answer is quite simple: no sequential programming language is suited for FPGA
<ikskuh>
people try, but they fail
<ikskuh>
the reason is that FPGAs are not computers
<ikskuh>
and programming languages are tailored for sequential computers
<ikskuh>
programming langauges assume stuff like registers, stacks, *memory*
<develonepi3>
I have used MyHDL and now I see Chisel. This is also geared to RISC-V world.
<develonepi3>
To compete with ARM.
<ikskuh>
can you elaborate?
<ikskuh>
i've taken a quick look at chisel and MyHDL, but i don't really see the appeal in them
blackbeard420 has joined #zig
<develonepi3>
For TLV Steve Hoover is using M4 with a product sandpiper.
<develonepi3>
Well at AWS some foks are running up to 1600 cores for things like face detection and Machine Learning.
<ikskuh>
i can't really follow
<ikskuh>
what is a "core" in that context?
<develonepi3>
Steve Hoover is using java to control the M4 which generates System Verilog.
<ikskuh>
so the original question was if Zig is suitable for HDLs and my answer to that is: definitly not
data-man has quit [Quit: Konversation terminated!]
<yZ5vlALg86lP>
may i ask what the difference is between `buf` and the return value []u8 in `pub fn bufPrint(buf: []u8, comptime fmt: []const u8, args: var) BufPrintError![]u8`?
<ikskuh>
yZ5vlALg86lP: buf is a backing storage, the return value is a slice of the backing storage containing the result
<yZ5vlALg86lP>
couldn't the backing storage be also be already a slice?
<ikskuh>
yes, it's a slice ([]u8)
<ikskuh>
you pass in a set of bytes that is enough for the formatting (this is backing storage)
<ikskuh>
and bufPrint will fill that storage with a formatted string
<ikskuh>
and will return the portion of the backing storage which was filled
CodeSpelunker has quit [Quit: CodeSpelunker]
<yZ5vlALg86lP>
ah. so the two values could be the same, and if i know that in advance i could just _ = bufPrint() catch ...;
<yZ5vlALg86lP>
where the two values = the return value and buf
<novaskell>
develonepi3: there's also clash-lang (haskell) and an attempt to compile haskell directly https://github.com/conal/concat
sord937 has quit [Quit: sord937]
<ikskuh>
yZ5vlALg86lP: no, you should not ignore it
<ikskuh>
the returned value will surely have a different length
<ikskuh>
usage example:
<ikskuh>
var backing_store: [256]u8 = undefined ; // 256 byte of memory to store our formatted string
<ikskuh>
var formatted = try std.fmt.bufPrint(&backing_store, "{}", .{ 10 }); // this will format the number into the string
<ikskuh>
// formatted is a pointer to backing_store, but with len=2 instead of len=256
<yZ5vlALg86lP>
i'm doing: var hex: u[64] = undefined; and then _ = bufPrint(hex, "{x:0>64}", someother[32]u8) catch ...
<ikskuh>
backing_store is still 256 bytes long. 2 of which are defined by bufPrint, 254 which are undefined
<yZ5vlALg86lP>
eh. not even
<ikskuh>
this is a special case: your backing store is exactly as long as the formatted result
<yZ5vlALg86lP>
the var hex: is actually allocated, not undefined.
<ikskuh>
yeah, doesn't matter in that case
<ikskuh>
got to go
<yZ5vlALg86lP>
so i can in my case just ignore the return value. thanks!
<yZ5vlALg86lP>
thanks!
<ikskuh>
i wouldn't ignore the return value, it's bad practise ;)
<ikskuh>
but it works in that special case
<ikskuh>
have a good night (or appropriate time zone respective greeting)
<yZ5vlALg86lP>
you too
<yZ5vlALg86lP>
i use the bufPrint to fill a field in a struct, and that field of the struct is the backingstore, i dunno what to do with the return value from bufPrint really
<yZ5vlALg86lP>
i could compare it to be the same as the backingstore slice. but i dunno if that makes any sense.
marnix has joined #zig
marnix has quit [Ping timeout: 240 seconds]
Seich has joined #zig
Cloudef has quit [Ping timeout: 240 seconds]
Cloudef has joined #zig
<hch>
exploring golang and zig in depth at the same, let's see how it goes
<RodBiren>
Apparently trying to cross compile easily?
<Seich>
:q!
<g-w1>
I am trying to impliment type equality checking for error sets and am a little confused to get the elements of the error set. i have `a.cast(Payload.ErrorSet).?.decl.scope.cast(Module.Scope.Container).decls`. but this doesn't give me the items in the error set? from my debugging in gdb, the scope of the decl of a Type.Payload.ErrorSet is a container but at line 2702 in type.zig it says that error set is not a
<g-w1>
container. what should I cast the scope to? this confused me a bunch. any help would be appreciated.
tane has quit [Quit: Leaving]
<g-w1>
this is in stage2 of the self hosted compiler
Kingsquee has joined #zig
<teratorn>
what's the format specifier to specify float precision?
<companion_cube>
%.4f I guess?
<teratorn>
well i have a {} placeholder in a log.err formate
<ifreund>
teratorn: see the doc comment of std.fmt.format
<teratorn>
hmm. im trying {e:.2} and {:.2} and it doesnt matter :/
<teratorn>
i dun get it
donniewest has quit [Quit: WeeChat 2.9]
<teratorn>
ifreund, do you know what im doing wrong?
zipp has joined #zig
<ifreund>
teratorn: {:.9} seems to work fine for me
<teratorn>
oh maybe it works i just dont want engineering notation
<teratorn>
ifreund, i dont see a specifier for regular decimal notation.. (?)