14 ms·
Zig 0.4.0 Released
- wgarry155 8y agoGood day, I am here to share the world of hacking with you all At Trifix Hack World, we provide professionals and expert computer programmers to hack and get into any individual’s system to check for system’s security.where we offer wide ranging menu of services. Our team focus on security mechanisms of computer and network systems and we do not prefer social engineering, hence we provide quick service and our results are fast and as a team of professionals we keep privacy and confidentiality to our consumers. Hacking generally used by various companies to check protection of there application, they allow hackers to find loopholes in software system and try to gain access to system in any manner to prevent security threats. Hire hacker to make your system more secure as attacks on web increases as time progresses.Website hacking and removal of unwanted contents online, We can also help to prevent confidentiality of mobile phone and email data by trying different methods to get into mobile phone and email accounts. Web database in most vulnerable to attack because it contains more secure data, many companies hire hacker to make there database safe from security point of view. Mostly people want to hire our professionals to check on their partners/friends/relatives, to gain their social media account password or to obtain their email address password or to remotely access there phone and gain whats app messages and other text and call details with saved photos and videos.Or if their account is compromised Or sometimes to gain someone’s website database or to modify something in another website/server, Developing Virus to inject in website SQL . we keep these things 100% confidential, if you need this services then you can contact via email address trifixblackhat1 at gmail dot com
- jph 8y agoZig's new release has a ton of improvements: new targets (e.g. LLVM 8, WASM, support tiers), C pointers, Vector type, better docs, and my personal favorite: Zig now makes things as static as possible by default. I love seeing all the progress with Zig, V, Muon, and Rust. All these languages are potentially-better systems languages than C/C++, with better safety, better definitions, and better semantics. Zig has an explicit goal to be better than C and to replace it.
- MuffinFlavored 8y agoIsn't V fake? https://github.com/vlang/v https://github.com/vlang/v
- saagarjha 8y agoI wouldn't call it "fake", but yes, it has not been publicly released.
- Cyph0n 8y agoI’m honestly way more interested in Jai.
- xena 8y agoCan you link to Jai?
- saagarjha 8y agohttps://inductive.no/jai/ https://inductive.no/jai/
- Cyph0n 8y agoHere is a link to a primer written by the community: https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md Right now, the only way to actually see the language in action is to tune in to Jonathan's livestreams on Twitch. He is writing his next game entirely in Jai. He also streams compiler development every now and then (last night was a compiler stream).
- verdex_phone 8y agoThat's not particularly charitable. The accidental AMA that happened on HN a few weeks back gave me the impression that V lang isn't as polished as a concept as some of the other offerings out there. BUT the author seemed tp have something brewing. And regardless we'll have some more evidence in the coming months. Regardless, V lang is another data point that something besides C is a possibility with the modern tools that we have available to us. Whether or not it pans out is almost immaterial. Just the fact that so many people are finding some sort of success or making some sort of progress in this space is enough for me to continue to watch for any new progress in the C competitors.
- lsh 8y agoThe Zig language has a great premise, it's worth reading the above link or watching a bit of this video https://youtu.be/Z4oYSByyRak?t=150 https://youtu.be/Z4oYSByyRak?t=150 just to question our assumptions that certain language features need exist at all.
- zamadatix 8y agoEdit: Just confused myself, comments are // and multiline literals are \\. Thanks to laszlokorte for catching my mistake! Zig claims very proudly it is about clarity but shortly into reading through the documentation I already found this extremely surprising: "Multiline string literals have no escapes and can span across multiple lines. To start a multiline string literal, use the \\ token. Just like a comment, the string literal goes until the end of the line." I could not have tried to make a more confusing token for multiline string literals if I tried. The difference between a string literal and comments is literally whether or not the lines are preceded by an open =.
- laszlokorte 8y ago> The difference between a string literal and comments is literally whether or not the lines are preceded by an open =. Well comments use forward slash (//) and string literals use backslash (\\)
- zamadatix 8y agoAh thank you, just confused myself on wording for a minute there. That makes sense, original comment edited.
- gloira32 8y agoIt's on one hand a bit annoying that each line is prefixed, because you can't paste like you can in Python, but on the other hand, the prefix allows it to be indented in a not-ugly way.
- est31 8y ago> The difference between a string literal and comments is literally whether or not the lines are preceded by an open =. Python has an even closer relationship between comments and string literals: its multiline comments are just string literals that get never used.
- hermitdev 8y ago> Python has an even closer relationship between comments and string literals: its multiline comments are just string literals that get never used. That's not entirely true. A literal string immediately following a class or function is inspectable via its __doc__ member. E.g. class Foo: "I am Foo." def bar(self): "I am Foo.bar" Foo.__doc__ will have "I am Foo.", and Foo.bar.__doc__ will have "I am Foo.bar". This is rarely used programattically, but at least one standard module uses this for running tests: doctest Edit: not sure why it's not formatting correctly, as I am spacing the code a 4 space indent, but at least on my phone, it is not properly formatting as code. I apologize.
- voldacar 8y agoThanks for all your work on this project Andy! It's been a real pleasure seeing Zig grow, hopefully it can fill that niche for a high performance, portable, modern language that isn't filled with OOP cruft
- dmix 8y ago[Off-topic] Another programming language website with no code examples front/center on the homepage? When you click "Download & Documentation" there's a link under the headline "master" to the long-form documentation which has some examples: https://ziglang.org/documentation/master/ https://ziglang.org/documentation/master/ Edit: also found a blog post with a nice introduction: https://andrewkelley.me/post/intro-to-zig.html https://andrewkelley.me/post/intro-to-zig.html and an examples directory: https://github.com/ziglang/zig/tree/master/example https://github.com/ziglang/zig/tree/master/example Interesting to see how the language has evolved away from using "%" in the original Hello world: const std = @import("std"); pub fn main(args: [][]u8) -> %void { // Print "Hello World!", and believe that no errors will happen std.io.stdout.printf("Hello World!\n") %% unreachable{}; // Short version: %%std.io.stdout.printf("Hi!\n"); } Compared to the newer version : const std = @import("std"); pub fn main() !void { // If this program is run without stdout attached, exit with an error. const stdout_file = try std.io.getStdOut(); // If this program encounters pipe failure when printing to stdout, exit // with an error. try stdout_file.write("Hello, world!\n"); }
- daurnimator 8y agoLooks like someone just filed the lack of samples as an issue: https://github.com/ziglang/zig/issues/2218 https://github.com/ziglang/zig/issues/2218
- manaskarekar 8y agoMy favorite website for an example of this functionality is: https://dlang.org/ https://dlang.org/. Succinct examples on a clean page, no fluff.
- Thaxll 8y agoYes, the homepage for Go is similar https://golang.org/ https://golang.org/
- bjourne 8y agoI've played with it for a few hours now and it feels promising. But also very hard to get into. There is not a lot of documentation nor code examples to look at. I'm trying to write the equivalent of int main(...) { for (int i = 0; i < argc; i++) { for (int j = 0; j < strlen(argv[i]); j++) { printf("%d %d %c\n", i, j, argv[i][j]); } } } in Zig, but figuring out how to do formatted output in the language wasn't so easy. Another small annoyance was Zig rejecting \r in line endings. Thankfully, I'm using Emacs so it only took me 15 minutes to google the right fix. But it felt a little "gratuitous" if you know what I mean.
- tiehuis 8y agoHere is a repository with a few more small code examples which may be helpful: https://github.com/tiehuis/zig-rosetta https://github.com/tiehuis/zig-rosetta The code itself should be up to date for most, but I'm aware of a few examples than need touch-ups. Unfortunately there is a bit more boilerplate compared to other languages for some simple tasks, since Zig requires you to be quite explicit about things (e.g. i/o, memory allocation). Regarding the rejection of '\r', there is the intention for `zig fmt` to handle these minor issues and reformat code as needed which hopefully reduces this barrier. There was a long issue regarding hard tabs with discussion here: https://github.com/ziglang/zig/issues/544 https://github.com/ziglang/zig/issues/544
- wyldfire 8y ago> 4. blake hash of file contents Why this algo in particular? Is this a security feature? I suppose wrt "Reflections On Trusting Trust" it may be. But if it didn't need to be secure it could probably be a lot faster (assuming this is a critical path for cache hits).
- AndyKelley 8y agoI didn't put a lot of consideration into the algorithm in particular. I was going to do SHA-256 but somebody told me Blake was faster. I haven't tested the performance of any other algorithms, but that's a completely swappable component. I'm sure the hash function will be swapped with a different one before 1.0.0 is done.
- tiehuis 8y agoAs an example, xxHash [1] would probably get you an easy 5-10x performance improvement over Blake2b. So there are some easy improvements if the cryptographic requirement is not needed. [1] http://cyan4973.github.io/xxHash/ http://cyan4973.github.io/xxHash/
- rurban 8y agoor better wyhash. xxHash and xxh3 still has some weaknesses.
- skybrian 8y agoThe build artifact caching algorithm seems rather clever and other build systems should take a look: https://ziglang.org/download/0.4.0/release-notes.html#Build-Artifact-Caching https://ziglang.org/download/0.4.0/release-notes.html#Build-...
- timClicks 8y agoWow, that easy cross-compilation story is great. Neat ergonomic benefits also, like Zip downloading musl on your behalf to create static binaries.
- AndyKelley 8y agoNote that it's not downloading anything. Zig ships with musl source code and builds it from source for the target.
- timClicks 8y agoThat makes a lot of sense. I've been playing around with embedding sqlite for a Rust project and checking the C into the source tree made sense there too.
- ken 8y ago"Zig is aggressively pursuing its goal of overthrowing C as the de facto language for system programming." If there's one truth I've learned in my decades of dealing with computers, it's that you can't beat C at being C. Before now, I'd never heard of Zig in particular, but I can think of several other languages that have tried or are currently trying. A lot of people seem to think they can make something a little better than C, in some ways, and that will be enough. I doubt that even C18 itself, if it were invented from scratch today, would be able to unseat another systems programming language. Everybody forgot about Worse-is-Better: "Unix and C are the ultimate computer viruses". Any language which isn't more 'viral' than C (in terms of being ported, and attracting users) has no chance. You're starting tiny, and growing less quickly.
- pjmlp 8y agoWe could, back when using C meant having to enjoy access to an UNIX computer center.
- audunw 8y ago> If there's one truth I've learned in my decades of dealing with computers, it's that you can't beat C at being C. Have you ever seen a language that has made a serious attempt? The last few years, the only significant one I know of is Rust. But it's not really a C replacement. C is essentially fancy assembly. Rust is conceptually quite advanced. Zig is one of very few languages I've seen that makes a serious attempt at being a better C. No garbage collection, no fancy borrowing checker, but quite a few improvements/features that actually matter to low-level/embedded programming. My use-case is microcontrollers, and I've tried a few different new languages for fun. Zig is the first one where I actually came out of it wanting to use it for real. The only problem is it's still not finished.
- abainbridge 8y agoHave you got an example of a C replacement that was actually better than C, got as far as Zig and is now abandoned? I can't think of one. I've been look for a better C for 15 years and Zig is the best candidate I've found. I don't think DasbetterC counts, since it is a side effort to the greater goals of D.
- stateoff 8y agoThere are so many neat design choices in zig that make it a joy to code in it even these days. Can't imagine what we get with 1.0. Some of my personal highlights: - clean syntax - comptime (as explicit and simple as it should be) - reflection - minimal/no external dependencies - single threaded mode (instead of taking cuts at runtime) - concise and explicit error handling - build-in build system - amazing C interop ... Good sample code can also be found in the standard library, and it has the benefit of being up to date with with language. Thanks Andy!
- rhodysurf 8y agoThe standard library is surprisingly present to read and learn from, kinda like go. I really enjoy learning zig.
- nimmer 8y agoI'm surprised nobody is pointing out the similarities with Nim in terms of features: multiple targets (binary, js...), C interoperability, easy cross-compilation, metaprogramming, targeting many architectures, artifact caching.
- pdimitar 8y agoIf we look at it that way then OCaml should be on the list as well. :)
- lazyjones 8y agoHm, a one-liner turnoff: const std = @import("std"); * pointless semicolon * pointless "@" * seemingly pointless "const" (can you define a mutable import?) * unnecessary verbosity defining an identifier for the import when there's almost never a need for naming it differently (i.e. it should default to "const std" if you just type "import 'std'"... I like Go because it avoids pointless verbosity most of the time.
- GolDDranks 8y agoI'd avoid picking on a language just by one line – it's not a language for writing one-liners, in which case the critic would be valid. There might be very good reasons for each of those things, but it's hard to say without delving into it some more.
- andrewchambers 8y ago> I like Go because it avoids pointless verbosity most of the time. Except for all those times you had to manually write err != nil
- butterisgood 8y agoI think you can also write use @import("std"); but then you've just imported all of std into your own namespace. (probably not using the correct terminology here). At any rate the const indicates you're not changing, and the std is the name given to the root of the hierarchy for importing "std" into. Sure go lets you do this too, but has shorthand. import "fmt" can also be done as import fmt "fmt" but why would you do that? The go equivalent of zig's "use" is import . "fmt" "." means "the current working directory" on unix so it's familiar to folks in that sense perhaps. Principle of least surprise is nice when the syntax is terse. Still, I think I like zig. I feel like I want to try to write something non-trivial with it when I look at the features. I've already done that a few times with Go, and I enjoy that too.
- yotamoron 8y agoIf Zig's goal is 'replacing C', then its DOA. How can this be a valid goal for a programming language?
- sgt 8y agoIts goal is similar to that of Rust. I'm sure it has more goals than only replacing C. Effectively it can become yet another systems programming language, but potentially one of the best, and thus replace C (or work alongside C in existing programs). I haven't played with Zig but it looks a lot more appealing than e.g. Rust to me. In the end though, I'll prefer plain old C (C99 or C11).
- enqk 8y agoI have one criticism: although zig has advertised very early on an amazing array of targets (probably taken from clang/llvm itself), some of the most esoteric ones have never worked for me, like powerpc (32bit) and MIPS. The blame is not entirely in zig but also in LLVM. It would be more fair to not even mention them as supported _at all_, or at the very least to document them as Tier 4.
- AndyKelley 8y agoI made that mistake before and I apologize for that. For this release cycle, I went through and tested creating a simple object file for all the targets, when categorizing them into tiers. So I think that if you try powerpc (32bit) and MIPS again you will find that they work now (probably because of LLVM improvements). If that is not the case, that is a bug and I would like to know about it.
- enqk 8y agoI'll file some bug report. Because I've tried to build a plain hello_world.c for ppc (without using stdio even) and encountered issues with libunwind (had to fix the assembler syntax which apparently does not work anymore with modern llvm) and both musl and gnu libc were both complaining and could not be build.
- _pmf_ 8y agoThe meta programming approach is pretty unique.
- salicideblock 8y agoBeyond zig as a language, these release notes are a treat for anyone interested in toolchains and environments for system languages. - "zig is also a C compiler" . Flag-compatible with clang, and with integration with zig's buildsystem you get cached build artifacts. - Cross compile for a boatload of architectures + musl or glibc - in a ~30Mb compressed package
- ahaferburg 8y agoAndy, if you have the time I think it would be interesting to read a retrospective from time to time. If you were to start over with the knowledge you have gained, what would you do differently? What would you rather have postponed? What would you have started earlier?
- ameixaseca 8y agoFirst time I saw a presentation on Zig by its creator it left a bad taste in my mouth: I looked like a "simplified Rust", with a lot of suspiciously similar names on the standard libraries and default types, yet there were zero references to Rust in any part of the presentation. In fact, it seemed like there was an active effort to avoid mentioning Rust, even though a lot of the things addressed by the language are/were some pain-points in Rust. It's noticeable that there are a lot of differences, and some things seem to have been deliberately made different (even if they are in essence very similar and only syntactically different), so for me it looks a bit odd that most references to Rust on his blog nowadays are of adversarial nature (ie, "look how better we are than Rust"). Last, but not least, it also doesn't help with the big picture that the one continuously posting links about Zig here is just self-promoting their own creation... Anyway, just my $0.02
- lsh 8y agoIf you're accusing the author of something just spit it out. > the one continuously posting links about Zig here is just self-promoting their own creation Nothing wrong with that. If their creation fails to excite people, there won't be any conversation, it won't make it to the first page, etc.
- hawski 8y agoHooray for vector type. Language does not require operator overloads when math has proper first-class support. That's my favorite bike-shed color.