rml, to zig

out of the new "modern #C" or "C+" or whatever languages like (right), (left) seems to be the nicest, at the language level at least. clean block structure is hugely underrated and otherwise nice languages that take it for granted to ensure you can do

node.* = .{ .data = value, .next = null };
if (this.end) |end| end.next = node
else this.start = node;
this.end = node;

...completely ruins a block's clarity with too much syntax, which is part of what makes C code very confusing depsite being a minimal language (I also think there is something nice about the way that C does it, but its nice because you've seen it forever, not because they were great design decisions)

meanwhile I don't need to read anything about hare or even squint to read the code and understand whats happening.

pub fn Oucue(comptime Child: type) type { [ T const This = @This(); const Node = struct { data: Child, LSS [N } gpa: std.mem.Allocator, Bl el (LN end: ?*Node, pub fn init(gpa: std.mem.Allocator) This { return This{ gpa = gpa, BTN ELE VI iy b pub fn engueue(this: This, value: Child) !void { const node = try this.gpa.create(Node); node. = .{ .data = value, .next = null }; if (this.end) |end| end.next = node // else this.start = node; this.end = node; b pub fn dequeue(this: *This) ?Child { const start = this.start orelse return null; defer this.gpa.destroy(start); if (start.next) |next| this.start = next (AT this.start = null; this.end = null; b return start.data; b iy b test "queue” { var int_queue = Queue(i32).init(std.testing.allocator); try int_queue.enqueue(25); try int_queue.enqueue(50); try int_queue.enqueue(75); try int_queue.enqueue(160); try std.testing.expectEqual(int_queue.dequeue(), 25); trv std.testina.expectEaual(int aueue.deaueue(). 50):

bortzmeyer, to zig French
@bortzmeyer@mastodon.gougere.fr avatar

Le langage de programmation a mieux que le commentaire TODO, un mot-clé spécial pour dire que le programme ne devrait jamais arriver là : https://zig.news/nathanfranck/effective-stubbing-using-unreachable-32go

sos, to programming
@sos@mastodon.gamedev.place avatar

Every single time I check out one of those upcoming shiny new programming languages that claim to be simple:

pinpox, to graphics

Can anyone recommend a 2d library for ?

Looking for something like https://github.com/jackdbd/zig-cairo but in maintained, that lets me draw pixels/lines/circles and export an image.

bortzmeyer, to zig French
@bortzmeyer@mastodon.gougere.fr avatar

Ah, je viens de tester et c'est vrai. Je ne sais pas combien de langages de programmation ont ça mais #Zig impose désormais que les variables qu'on ne modifie pas soient déclarées comme constantes. https://ziggit.dev/t/error-local-variable-is-never-mutated/2238

JustineSmithies, to zig
@JustineSmithies@fosstodon.org avatar

Gone back to #RiverWM for a while as Qtile under #Wayland is really not that stable at the moment and what with the latest Python release things got worse under #Void so I'm going to give River another shot but I am tied between it and #Sway as a fallback to Qtile. Hyprland just doesn't interest me, Been there got the t-shirt thanks but no thanks. Fingers crossed development picks up soon on River and they move to Zig 0.11.0 . Might even tempt me to start learning #Zig ? 🤔

JustineSmithies, to zig
@JustineSmithies@fosstodon.org avatar

Hmm #RiverWM has updated to using #Zig 0.11.0 but #VoidLinux doesn't seem like it's going to get the Zig update anytime soon. As much as I love Void I've hit a few barriers which to be fair are probably my own doing because sometimes I want to run the latest from git. Not sure what the answer is? Do I suck it up and try another approach or do I head back to my roots aka Arch ?

pb, to zig French
@pb@mast.eu.org avatar

À l'atelier #Zig de @bortzmeyer aux #jdll.

britown, to zig
@britown@mastodon.gamedev.place avatar

Reading about using zig as your build system and considering moving on from makefiles into the land of light and serenity

#zig #gamedev

arne, to zig
@arne@spezi.social avatar

classic experience

ekuber, to zig
@ekuber@hachyderm.io avatar

For anyone familiar with , does the following code properly provide Zig's defer concept?

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=4db95b47e54d96f772e0c49bd8b1dc07

bortzmeyer, to zig French
@bortzmeyer@mastodon.gougere.fr avatar

#programmation

Il y a vraiment des gens qui ont choisi #Zig plutôt que Go ou Rust ?

vitaut, to programming
@vitaut@mastodon.social avatar

What's Zig got that C, Rust and Go don't have? https://www.youtube.com/watch?v=5_oqWE9otaE

ekaitz_zarraga, to guix
@ekaitz_zarraga@mastodon.social avatar

So my talk is uploaded.

https://fosdem.org/2024/schedule/event/fosdem-2024-1755-risc-v-bootstrapping-in-guix-and-live-bootstrap/

I talk about -bootstrap there but the goal was to send a different message, a human message.

Also some question happened!
All the cool things together.

If you like the way I talk, you can hire me to teach you things, or code for you or something idk.

macleod, to haskell

Various thoughts on too many programming languages, for no discernible reason.

I have been interested in Go since it's very initial release, but their dependence on Google is uncharming to say the least. I still haven't made up my mind on its GC, but its definitely better than most.

I used to do some ML work in .NET and if it wasn't dependent on Microsoft it would be a heavy contender for a great language, but it has far too many Microsoft-isms to ever really go much farther.

Rust is great, I enjoy beating my head against a brick wall battling with the compiler, and their safety is great, but overly complicated and feature-creep is a real problem on that entire project. I do a lot of work these days in Rust, for better (mostly) or worse (mostly-ish).

C is my bread-and-butter, as is Javascript for quick prototyping.

Elixir is great, but Erlang is unwieldy, the community is growing, but not fast enough - and I just can't get my mind to enjoy the syntax no matter how nice it is.

D is a lot of fun, but their GC can be slow at times, and the community is very small and packages are often broken and unmaintained.

Python was my first true love, but I really can't stand the whitespace, again love the language, hate the syntax.

Zig is fun, but just that. Fast, nimble, but early days, a bit confusing, could replace my insistence on C for core projects, but again, early days. I love to use them as a compiler for C, much faster than the defaults on any of the others.

Odin is one I love to keep an eye on, I wish I could get behind using it for more things. When I first took notice ~4 years ago the documentation was a bit scattered, but it looks much better now. The developer behind it is incredibly cool, could be seen as the next Dennis Ritchie imo. Runes are dope. The syntax is by far my favourite.

Julia, I love Julia, but performance last I tested was a bit of a miss, and by miss, it required a decent chunk of compute for basics, but when you gave it the system to throttle, it would be insanely productive to write in. Javascript is something that I prototype even syscalls in, but Julia is just the same but much better and more productive (and less strange) in many regards. I am really hoping this takes over in the ML/Data world and just eats Python alive. I've heard there has been major work in the perf department, but I haven't had reason to try it out lately.

Ada, memory safety before Rust! Great language, especially for critical applications, decades of baggage (or wisdom), slow moving language, insanely stable, compilers are all mostly proprietary, job market is small, but well paid, great for robotics, defense, and space industry types, but the syntax is... rough. Someone should make a meta-language on top of Ada like Zig/Nim/Odin do for C, or Elixir does for Erlang.

The others: Carbon, haven't tried; Nim, prefer when they were "Nimrod" (cue Green Day), decent but not my style; Crystal, seems cool, but not for me; Scala, great FP language, but JVM; Haskell, I'm not a mathematician, but my mathematician friends love it. I see why, but not my thing as much as I love functional languages. I'll try it again, eventually. I did not learn Haskell a great good.

I tend to jump from language to language, trying everything out, it's fun and a total timesuck.

[ # ] :: #c #d

jarkko, to zig
@jarkko@social.kernel.org avatar

i hope will be sustainable. i like its way more than . and like in C or even RISC-V microarchitecture, but not so much in Rust and C++, the language definition is compact enough so that it just stick into your head. also, comptime is really cool invention in my opinion. #C

https://ziglang.org/

javier_salcedo, to rust

I’ve been using new shiny languages for a while now. , and in particular.
I love Rust’s tooling, Swift’s syntax, and Zig’s philosophy, but I feel like good old is still the goat.

Yeah, the syntax can get out of hand really quickly.
Yeah, the STL is bloated.
Yeah, the tooling ecosystem is a mess.

But at the end of the day, with a good style guide and some discipline, it can check most of my boxes.

But learning new languages is always fun so I’m still doing it 😬

LGUG2Z, to rust
@LGUG2Z@hachyderm.io avatar

Does anyone know of any good "intro to #Zig for #Rust devs" articles or videos? 🤔

macleod, to rust

The Vale Programming language

We also discovered that they (Generational References) enable Vale to have complete memory safety, something no native language has been able to achieve.

  • No borrow checker
  • No GC
  • Writes like Go with a hint of Scala
  • FFI interop
  • No unsafe blocks
  • No comptime related keywords

https://vale.dev/memory-safe

[ # ] :: #c

lhp, to zig
@lhp@mastodon.social avatar

Might have written a regex library to unblock porting nfm to zig 0.11.0. Just one more item on my todo list before I'll tag a first release.

https://git.sr.ht/~leon_plickat/zig-exre

baadc0de, to rust

Will people stop comparing Zig's comptime to Rust's macros? They are not the same!

Sure, there is some overlap, but comptime can do things macros can't do (such as really nice assertion checks), and macros can do things that comptime can't do (such as code generation).

#rust #rustlang #zig

floooh, to zig
@floooh@mastodon.gamedev.place avatar

I just merged a pretty substantial update to the sokol-zig bindings:

  • "official" package manager support
  • integrated web build support (e.g. zig build -Dtarget=wasm32-emscripten "just works")
  • everything fixed for zig-0.12.0 nightly updates
  • the master branch is now "bleeding edge"

More details in the (also new) CHANGELOG:

https://github.com/floooh/sokol-zig/blob/master/CHANGELOG.md

...and the readme:

https://github.com/floooh/sokol-zig/blob/master/README.md

publicvoit, to programming
@publicvoit@graz.social avatar

What happens, when you join two paths in a language when the second one is an absolute one?

join("foo", "/bar")
returns "foo/bar" or "/bar"?

The wonderful @meisterluk wrote a great article about that you might want to read: https://lukas-prokop.at/articles/2024-05-03-filepath-join-behavior

I can not tell what version I'd actually prefer. There are situations where both versions would be "proper".

#C++

cashwasabi, to ZigLang
@cashwasabi@mastodon.gamedev.place avatar

What other architectures for data oriented design for games are there other than ECS?
#ecs #raylib #ziglang #zig #gamedev

sjb3d, to zig
@sjb3d@mastodon.gamedev.place avatar

The experiments continue, still very much liking it.

Dropping random C/C++ files in the build and having it just work is great.

Only minor issue I hit so far is missing syntax to make a slice from a single-item pointer (like slice::from_ref in Rust), but looks like this is getting fixed for 0.12 (https://github.com/ziglang/zig/issues/16075). And can work around in 0.11 with some comptime trickery.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • provamag3
  • mdbf
  • ngwrru68w68
  • modclub
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • InstantRegret
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • DreamBathrooms
  • JUstTest
  • GTA5RPClips
  • ethstaker
  • normalnudes
  • tester
  • osvaldo12
  • everett
  • cubers
  • tacticalgear
  • anitta
  • megavids
  • Leos
  • cisconetworking
  • lostlight
  • All magazines