ChanServ changed the topic of #zig to: zig programming language | https://ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
doublex has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
<telemach> is there any way to get struct's declaration similar to @field?
<telemach> oh, it seems to work for declarations
<telemach> @fields I mean; however, now I run into expected type 'fn(*comparable.Comparable, *comparable.Comparable) comparable.Comparison', found '(bound fn(*const comparable.Comparable, *const comparable.Comparable) comparable.Comparison)
<telemach> in the place where explicitly passing declaration doesn't cause type error
<telemach> ah, got it, I need to use @typeOf for my var first
SrMordred has quit [Remote host closed the connection]
chemist69 has quit [Ping timeout: 276 seconds]
chemist69 has joined #zig
rjtobin has quit [Quit: Leaving]
mahmudov has quit [Remote host closed the connection]
porky11 has joined #zig
kurufu has joined #zig
<kurufu> Does cImport do anything special to get linkages working? I fixed up a translate-c and used that as a normal @import but any calls to c functions end up segfaulting at 0x0 so i assume they just never got linked correctly.
<kurufu> (my fixup was only removing some offending enum members)
<mq32> kurufu: manually using the result of translate-c should work
mahmudov has joined #zig
firefox317 has joined #zig
firefox317 has quit [Remote host closed the connection]
ltriant has quit [Quit: leaving]
kenaryn has joined #zig
return0e has joined #zig
n_1-c_k has quit [Read error: Connection reset by peer]
n_1-c_k has joined #zig
kenaryn has left #zig ["WeeChat 2.3"]
samtebbs has joined #zig
samtebbs has quit [Ping timeout: 240 seconds]
Ichorio has joined #zig
jelleke has quit [Quit: WeeChat 1.0.1]
kenaryn has joined #zig
tdc has joined #zig
<kenaryn> Hello, I want to install zig-mode plugin for Emacs editor. I added the stable MELPA repository into .emacs file, then I updated the package list with `M-x package-refresh-contents` and type the following in order to retrieve the zig plugin: `M-x package-install RET` (i.d. ENTER key pressed) and zig-mode RET.
<kenaryn> Unfortunatly, the package is not found so I tried manually by browsing the repository with `M-x list-packages` RET but there is no "zig-mode" in the repository.
<kenaryn> I am using Debian stable 10.1 and Emacs 26.1 and I want to add that I followed the instructions noticed here: https://melpa.org/#/getting-started like the github zig-mode repository suggests. Any suggestions please?
mahmudov has quit [Ping timeout: 265 seconds]
mahmudov has joined #zig
samtebbs has joined #zig
knebulae has quit [Read error: Connection reset by peer]
_whitelogger has joined #zig
<daurnimator> kenaryn: sorry; I don't think many of the people here are emacs users...
<n_1-c_k> kenaryn, I seem to have a working zig-mode. I think I downloaded it directly from https://github.com/zig-lang/zig-mode and put it under my ~/.emacs.d.
<n_1-c_k> How to get past this https://paste.debian.net/plain/1104934 in order to build zig?
knebulae has joined #zig
samtebbs has quit [Ping timeout: 250 seconds]
<daurnimator> n_1-c_k: which os?
marijnfs has joined #zig
<n_1-c_k> daurnimator, debian unstable.
<kenaryn> Thanks for trying to help me. I downloaded zig-mode.el and moved it to "~/.emacs.d/" (nothing happened), then I moved it to "~/.emacs.d/elpa/" but it did nothing. Do you remember whether you ran a command before re-opening Emacs?
<n_1-c_k> kenaryn, ah yes there is another bit, minute...
<kenaryn> :)
<kenaryn> daurnimator, since you declare being a electrical engineer, you opinion matter to me, which editor do you use to develop any software?
<n_1-c_k> kenaryn, I run this at startup, https://paste.debian.net/plain/1105033 HTH
knebulae has quit [Quit: Leaving]
<kenaryn> So it is the same code than the 'git clone' alternative, thank you n_1-c_k, I will try it immediatly.
<daurnimator> kenaryn: I use sublime text. I got in the habit of using sublime's multiple cursros and now can't live without its exact semantics
<daurnimator> I don't necessarily recommend it for others; I'm only on it due to muscle memory/inertia at this point
<kenaryn> Allright, I am using sublime-text too but I installed emacs this morning :) It's entry barrier is unbelievable.
<kenaryn> Agreed, it is user-friendly once the keyboard shortcuts are memorized.
<daurnimator> people often find it hard to believe that I don't use/like vim
<bgiannan> kenaryn, doom-emacs is a pretty good emacs distrib if you're looking for an easiy way to install packages and still have a sane configuration
<bgiannan> easy*
<kenaryn> It is not hard to believe but you using vim was indeed my assumption :)
<mq32> just to comment the editor topic: I use Visual Studio Code for Zig because of ceymards autocompletion package :)
<mq32> it's quite handy to have at least basic autocompletion working
<kenaryn> Ahah thanks for sharing mq32 and bgiannan, but I'm determined to learn Emacs(GUI) and use it for the next decade. Its embedded terminal emulator seems very useful to do REPL without resorting to another tool and thereforce decrease the distraction and cognitive load (once well understood of course).
<daurnimator> why embed a terminal in your editor? your editor can already be in a terminal....
<daurnimator> alternatively, use a tiling window manager
<kenaryn> I do not understand, how can I embed sublime-text into a terminal?
knebulae has joined #zig
porky11 has quit [Ping timeout: 245 seconds]
porky11 has joined #zig
<kenaryn> n_1-c_k Adding the code you pasted (same as the github repository) produce the following error: File-mode specification error (void-variable <!DOCTYPE)
marijnfs has quit [Quit: WeeChat 2.6]
<n_1-c_k> kenaryn, my bag of ideas is empty... try in #emacs perhaps, g'luck
<kenaryn> After moving 'zig-mode.el' to '$HOME/.emacs.d/lisp/' and editing the path in the same way.
<kenaryn> Allright, thanks again. I'll stay silent or will talk about #zig only.
doublex has quit [Ping timeout: 265 seconds]
doublex has joined #zig
waleee-cl has joined #zig
<xyproto> I think Go is pretty great for small servers, C++ is pretty great for 3D engines. Where does Zig shine the most? Anything that C is currently used for today?
<scientes> 'small"
<xyproto> or large :)
<mq32> xyproto, Zig is also pretty great for game engines :)
<mq32> but i think it shines in "simplicity". it's easy to write and even more easy to read
<kenaryn> n_1-c_k For information, the zig-mode was in the MELPA bleeding-ede branch repository, not the stable one... lol :) Now I'm a Emacs user :D
n_1-c_k has quit [Read error: Connection reset by peer]
n_1-c_k has joined #zig
kenaryn has left #zig ["WeeChat 2.3"]
FireFox317 has joined #zig
<FireFox317> andrewrk: You forgot to rename the std/special/doc folder to std/special/docs. Currently the -fgenerate-docs cannot find the index.html and main.js to copy to the target directory
<FireFox317> Nice proof of concept btw, looks cool!
porky11 has quit [Ping timeout: 264 seconds]
<daurnimator> so.... zig packages.... what will a "package" be?
<daurnimator> e.g. a tarball of sources?
<daurnimator> (given that there isn't an ABI for zig libraries)
BitPuffin has quit [Read error: Connection reset by peer]
jzck has quit [Read error: Connection reset by peer]
Snektron has quit [Remote host closed the connection]
fengb has quit [Remote host closed the connection]
dtz has quit [Read error: Connection reset by peer]
D3zmodos has quit [Read error: Connection reset by peer]
vegai has quit [Remote host closed the connection]
Demos[m] has quit [Remote host closed the connection]
samtebbs has joined #zig
oats has quit [Ping timeout: 240 seconds]
oats has joined #zig
<mq32> daurnimator: i think support for something like "tarball" and "git repository+commithash" would be reasonable
<xyproto> mq32: cool. But if you write a vector library in Zig, is there something like operator overloading for "+" and "-"?
<mq32> nope
<mq32> it's a bit annoying, but i can live with that
<mq32> just fyi, i'm writing game stuff right now, progress of the weekend is this: https://mq32.de/public/screenshot/286436523c67e6dc337efe0f4b87302f.png
<mq32> only dependency to extern code is SDL2 for creating OpenGL context and the window
<daurnimator> mq32: I'm assuming there would be some sort of package metadata format to go with it....
<mq32> as soon as sdl-window is "good enough", i can drop SDL2 as well and be fully set up with zig code only
<mq32> daurnimator, i like packages that just require some "i am a package.filename"-file
<fgenesis> well you COULD reinvent .deb, .rpm, or whatever, and die in metadata hell :B
<xyproto> mq32: if you manage to get zig and sdl2 to work together nicely, I would love a pull request to https://github.com/xyproto/sdl2-examples :)
<mq32> xyproto: "just cInclude SDL.h" :D
<xyproto> mq32: That's one way. :) There are no Zig-friendly SDL2 wrappers?
<mq32> but if you want, i can hack you some example together tomorrow
<xyproto> mq32: that would be appreciated!
<mq32> i don't think someone wrote one
<mq32> because SDL2 is a quite conventient library to be used with zig
<mq32> maybe i'm writing some wrapper one day :D
<mq32> because something like
<mq32> while(SDL.pollEvent()) |event| { switch(event) { .mouseButtonDown => |mbd| { … }, else => { } } }
<mq32> would be aweomse
<mq32> *awesome
FireFox317 has quit [Ping timeout: 265 seconds]
mahmudov has quit [Ping timeout: 240 seconds]
<xyproto> mq32: that would be nifty
samtebbs has quit [Ping timeout: 240 seconds]
doublex has quit [Ping timeout: 276 seconds]
doublex has joined #zig
doublex has quit [Ping timeout: 264 seconds]
dimenus has joined #zig
doublex has joined #zig
FireFox317 has joined #zig
donpdonp has joined #zig
samtebbs has joined #zig
vegai has joined #zig
<tgschultz> andrewrk: re: bmp lib being broken w/ LLVM error. Are you ok with a 40MB package or should I trim the test data?
<andrewrk> tgschultz, no problem
<tgschultz> it compresses well, 218k in 7z
<tgschultz> run `zig test bmp_test.zig` to produce the error.
<scientes> looks like you develop on windows
<tgschultz> that's because I do?
<andrewrk> tgschultz, thanks
<tgschultz> it feels odd to be thanked for dumping a bunch of un-simpified code on you
<andrewrk> I should be able to figure it out by looking at the llvm ir code
<scientes> it should be double-star here
<scientes> %9 = getelementptr inbounds %"rgb.PackedBgra(5,5,5,1)", %"rgb.PackedBgra(5,5,5,1)"* %8, i32 0, i32 0, !dbg !8244
<scientes> oh its a struct that has the same type, but it needs a ptrcast from rgb.PackedBgra(5,5,5,1) to [2 x i8]* %9)
Demos[m] has joined #zig
BitPuffin has joined #zig
dtz has joined #zig
jzck has joined #zig
D3zmodos has joined #zig
fengb has joined #zig
wootehfoot has joined #zig
Akuli has joined #zig
doublex has quit [Read error: Connection reset by peer]
doublex has joined #zig
mahmudov has joined #zig
n_1-c_k has quit [Read error: Connection reset by peer]
n_1-c_k has joined #zig
FireFox317 has quit [Ping timeout: 250 seconds]
FireFox317 has joined #zig
FireFox317 has quit [Remote host closed the connection]
doublex has quit [Ping timeout: 240 seconds]
presiden has quit [Ping timeout: 245 seconds]
presiden has joined #zig
<n_1-c_k> Is this https://paste.debian.net/plain/1105204 along acceptable lines for suppressing color in runtime error messages?
Ichorio has quit [Ping timeout: 245 seconds]
<nrdmn> n_1-c_k: I'd write it in multiple lines instead of nesting ifs in a single line
<n_1-c_k> nrdmn, I did! But that's what 'zig fmt' turned it into.
<nrdmn> n_1-c_k: did you use curly braces {}?
<n_1-c_k> nrdmn, no - is that the trick? I'll try it...
lunamn_ has joined #zig
lunamn has quit [Ping timeout: 240 seconds]
Akuli has quit [Quit: Leaving]
<nrdmn> hmm.. are all those |_| required?
<n_1-c_k> nrdmn, compiler says yes
waleee-cl has quit [Quit: Connection closed for inactivity]
samtebbs has quit [Quit: Lost terminal]
<fengb> n_1-c_k: /// Caller must free returned memory.
<fengb> Those functions are designed to be memory managed. The whole error juggle was an attempt to force memory deallocation
<fengb> Each of the `getEnvVarOwned()` calls is a memory leak
<n_1-c_k> fengb: oh! How does one plug that leak?
<fengb> Inside the if (cond) |item|, the "item" needs to be freed by the allocator
<fengb> The else |err| returns an error state, which probably should be checked
<fengb> Since it can error out with OutOfMemory (which isn't falsy), or EnvironmentVariableNotFound (which is falsy in this case), or InvalidUtf8 (which I don't know what this means)
<fengb> I wonder why the Windows version is so complicated
<n_1-c_k> blimey, this is turning into a major project
<fengb> `os.getenv(key)` doesn't require an allocator so it looks a lot simpler, but it doesn't account for Windows
<n_1-c_k> works for me :D
<tgschultz> I think some of the Windows stuff could be cleaned up in std by removing the need for allocation at the cost of a static buffers because env vars and args have known limits.
<fengb> Oh heh
<fengb> wantTtyColor
<fengb> This uses FBA so it handles the leak by shoving it onto the stack
<fengb> Oh so you don't need to handle it! >_>
<fengb> Still probably should handle OOM though since that's a real edge case
<tgschultz> Maybe I should take a look at cleaning up args and env for Win while I'm waiting for bugs to be fixed
<fengb> I wonder if in this case, we should have a different function for 'hasEnvVar
<fengb> Since that's all it's doing, that could be a simple boolean instead of this crazy allocator thing that gets thrown away
* n_1-c_k likes the sound of "simple boolean"
<tgschultz> it would only require a 40k buffer on the stack in _start to just automatically grab the env and arg memory in windows. should be a way to avoid doing that if it is never used though...
<andrewrk> if this buffer is accessed during the call to main() it would not be thread safe
<andrewrk> s/accessed/populated/
<tgschultz> maybe a build option then? checked using @root or whatever it is called?
<andrewrk> that seems fine. it would be on by default and you could disable it, which would turn std.process.getEnvVar & friends into compile errors
<tgschultz> do we have a naming convention for such vars?
<andrewrk> no
<n_1-c_k> Is @root a post-0.5.0 thing? Can't find it in langref.
<tgschultz> I probably didn't call it the right thing
<fengb> "An environment variable has a maximum size limit of 32,767 characters, including the null-terminating character."
<fengb> That seems a little excessive per env var
<tgschultz> env vars share that space
<fengb> Oh it's global space?
<tgschultz> "All environment variables must live together in a single environment block, which itself has a limit of 32767 characters."
<tgschultz> and all args share an 8192 block...I should verify if that is bytes or ucs2 characters though. sounds like it might be ucs2, so that'd total 80k
<andrewrk> ucs2 can still have > 2 byte characters right?
<andrewrk> https://en.wikipedia.org/wiki/UTF-16#U+010000_to_U+10FFFF
<andrewrk> so that would actually be 128 KB
<tgschultz> I don't think so, UTF16 can, but UCS2 pre-dates the surrogate pairs
<fengb> UCS2 is fixed
<tgschultz> IT's why Windows can have unpaired surrogates in filenames and whatnot
<fengb> But not sure if this is actually UTF16 with bad docs (like JS)
<tgschultz> and it is in chars. the byte limit is 64k, one segment.
<tgschultz> oh wait, I see, the issue is we have to convert whatever windows hands us into UTF8
<tgschultz> ....which could be problematic
<tgschultz> at least in theory.
<mps> anyone can help me with building zig for Alpine linux? build log is here http://tpaste.us/Q1pb
<mps> and APKBUILD is here http://tpaste.us/Kgjq
<mps> I must tell that I don't have experience with zig but want to build it for alpine, and start to play and learn
<mps> on alpine default build option is PIE, afaik
<andrewrk> mps, I will create a patch for you to try
<mq32> tgschultz: afaik is windows using UTF-16
<mq32> or an arbitrary 8 bit multibyte-codepage, including support for utf-8
<mps> andrewrk: thanks in advance
<andrewrk> mps, try this patch: https://clbin.com/AwXri
samtebbs has joined #zig
<mps> ok, will do now
dimenus has quit [Read error: Connection reset by peer]
<fgenesis> mq32: win32 is UCS-2 but with support for surrogate pairs
<fgenesis> (one reason why WTF-8 exists)
<mps> andrewrk: looks like it worked, build goes without error
<mps> now comes hard work to prepare proper apk
<andrewrk> mps, I will run tests and then commit this patch to master
<mps> nice, thanks for help
<mps> btw, any good and simple (ask to much) introductory to zig for C programmers
<mq32> read the docs and then "just do it"
<nrdmn> note that some older docs call UCS-2 "UTF-16"
<mq32> you have to grasp some concepts like "null-pointers in C are optional pointers in zig", "types are just expressions"
<mq32> nrdmn, yeah encoding is a very confusing world
ltriant has joined #zig
<mq32> just use codepage 65001 everywhere
<mps> mq32: ok, will do
doublex has joined #zig
<mq32> andrewrk, do you already have some plans about #2915 (unpacked option aliasing)?
n_1-c_k has quit [Read error: Connection reset by peer]
n_1-c_k has joined #zig
doublex_ has joined #zig
doublex has quit [Ping timeout: 268 seconds]
<mps> got it, I mean alpine apk, now in crude form but will refine it in a few days
kenaryn has joined #zig
<kenaryn> daurnimator, are you there? I would like to ask you a question with regard to sublime-text path environment variable.
<nrdmn> andrewrk: what's the policy for changing or deprecating functions in the standard library? Should I make them output compile time warnings until next release instead of simply removing them?
kenaryn has left #zig ["WeeChat 2.3"]
<andrewrk> nrdmn, you can break std lib
<nrdmn> alright
wootehfoot has quit [Read error: Connection reset by peer]
<samtebbs> andrewrk: Thanks for the feedback on my i386-linux PR. I gave it a try and we don't get the same register allocations issues on release-fast, so should I make a new issue for the frame pointer detection? I'd be very happy to give it a try but would like to let anyone interested take it on.
<andrewrk> samtebbs, thanks, yes that sounds good
<samtebbs> andrewrk: Cool :)
samtebbs has quit [Quit: leaving]
mahmudov has quit [Ping timeout: 265 seconds]