Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why? What? Who? How? #1

Open
nelsonic opened this issue Jul 14, 2024 · 22 comments
Open

Why? What? Who? How? #1

nelsonic opened this issue Jul 14, 2024 · 22 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested

Comments

@nelsonic
Copy link
Member

Intro to the Zig Programming Language • Andrew Kelley • GOTO 2022: https://youtu.be/YXrb-DqsBNU

@nelsonic nelsonic added documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested labels Jul 14, 2024
@nelsonic
Copy link
Member Author

If you're reading this, please don't worry, for now it's just a placeholder. 💭
I definitely don't have time to be learning a whole new programming language ... ⏳
But I will be returning to this in the future. 🤞

@ndrean
Copy link

ndrean commented Jul 14, 2024

Excellent idea! Zig seems the thing, cross-compilation, compiles C code (cf FFmpeg for Zig

@nelsonic
Copy link
Member Author

@ndrean yeah, we agree. 💡 😉
A friend of @dwyl is super keen on TigerBeetle which is built in/with Zig. ⚡
We've watched a few videos e.g: youtube.com/watch?v=sC1B3d9C_sI and are very impressed. 😍
It seems considerably easier to learn Zig than Rust (at least on the surface) and equally reliable/performant. 🏎️

Zigler https://hexdocs.pm/zigler/Zig.html -> https://github.com/E-xyza/zigler is actively developed/maintained 🙌
And allows incredible flexibility to run a specific/separate OTP app to execute the Zig functions/programs.
Supports Nerves out-of-the-box so if we need to do something "low level" in IoT we can use a NIF.

Getting all the fault-tolerance, observability and developer happiness of Elixir 💧
and being able to use the performance of Zig when we see a bottleneck feels like an awesome combo! 🦸‍♂️

@nelsonic
Copy link
Member Author

nelsonic commented Jul 15, 2024

Read this post: https://matklad.github.io/2023/03/26/zig-and-rust.html 👀

@ndrean
Copy link

ndrean commented Jul 15, 2024

Thanks for sharing! ❤️ I only skimmed Rust, and when I started to read a bit about async in Rust, I understood Rust was not for me. I am also curious about Go.

In my TO_VIEW list: don't write NIFs

@nelsonic
Copy link
Member Author

Yeah, the 100% agree with not writing NIFs in C! 😬
The biggest danger with NIFs is the "Shiny Object Syndrome" https://en.wikipedia.org/wiki/Shiny_object_syndrome
whereby people start implementing Business Logic in the NIF instead of just a single perf-focussed function! 🙃
And that is a recipe for chaos if you do it in C where the are no safeguards! 🎲

To-be-clear: C and C++ were the languages I used for years before I got into Web Dev. ⏳
So I would be pretty confident writing NIFs in C ... 🤓
But I wouldn't for the simple reason that I don't wan to maintain them! 🙅

NIF (Native Implemented Functions) docs: https://www.erlang.org/doc/system/nif.html 🔗
explains why someone would want to use one if there's a perf bottleneck. 🤔
i.e. 99% of the time Erlang/Elixir is perfectly performant 🏎️
because the bottleneck in most apps is the Network and Database latency! ⏳

Zig makes a lot of sense for NIFs because the language is easier to learn than Rust
https://www.reddit.com/r/elixir/comments/hel3ps/zigler_elixir_ffis_with_zig/

So far I've only noted the technical reasons for learning Zig.
But one of my biggest reasons for learning Zig (towards the end of this year),
is simple: Career / Employability relevance.
A few of my friends working in finance are starting to use Zig. 🏦
Mostly because TigerBeetle dwyl/technology-stack#112

But I suspect it might be the reason a few other people learn Zig:
https://survey.stackoverflow.co/2023/#section-top-paying-technologies-top-paying-technologies

stackoverflow-top-paying-tech

Good to see Erlang still in the Top 🔝 (second place after Zig).
Ref: https://blog.logrocket.com/comparing-rust-vs-zig-performance-safety-more/
Looking forward to seeing where these languages are in the 2024 survey.
Yes, I know this survey data/result is very skewed by having low numbers of respondents for the lower usage languages ... so take everything with a grain of salt. There are still Fortran and COBOL programmers with deep institutional knowledge of their Bank / Gov systems who are earning way more than the Zig average. 🙃
Same way there are AI/ML engineers at Startup X writing Python and getting paid millions in <options> that will pay-off if their Unicorn gets acquired / goes public ... 🦄 📈 💰

As usual, I like to be proactive with my learning; I see myself writing Zig in the future. 💭
I definitely will still write Elixir because I still think it's great for network apps! 🕸️
I love the reliability of Elixir. But I know I'm not going to convince any of my Finance friends to use it. 🙄

Zig might be the answer for "What Language to Learn Next?"

@ndrean we are currently writing Go on a Project it's going well. 😉

@nelsonic
Copy link
Member Author

What's Zig got that C, Rust and Go don't have? (with Loris Cro): https://youtu.be/5_oqWE9otaE @kristoff-it
image

Again, trying not to get sucked into this right now as have lots of work to do. ⏳

@nelsonic
Copy link
Member Author

@ndrean
Copy link

ndrean commented Jul 15, 2024

Thanks for sharing!
I looked into TiggerBeetle. But banks are so conservative! Do they adopt this? Tbh, I really know nothing about banking IT but I am sure of one thing: safety is above everything.

💭 So what about building the Elxiir client for TiggerBeetle? You can promote fault tolerance, scalable web app using Elixir, and interface with Zig? With the advance of LiveView native, you could even propose a mobile version, mandatory I imagine ....

I loved this picture
Screenshot 2024-07-15 at 23 24 47

@nelsonic
Copy link
Member Author

@nelsonic
Copy link
Member Author

And to answer your question from above: Yes, some banks are ultra-conservative and avoid any tech innovation. 👴
I've worked at/for a few and they weren't fun ... 🐌 ⏳ M&Ms ... 🙃

But others are always trying to get an edge and invest heavily in their tech/teams!
It all depends on how Management/Execs view their Tech:

  1. "IT" is usually viewed as a "Cost centre": https://en.wikipedia.org/wiki/Cost_centre_(business)
    i.e. to be minimised and as "stable" as possible; change is the enemy as it drives up cost!
  2. "Engineering" is usually viewed as an investment and innovation i.e. a potential "Revenue Centre": https://en.wikipedia.org/wiki/Revenue_center where investing $1 in building something that gives the firm an edge in the market can return $2 and sometimes $100 ... think Goldman or Bridgewater which has been investing heavily in ML for decades!
    https://www.bridgewater.com/research-and-insights/greg-jensen-on-algorithmic-decision-making-and-artificial-intelligence
image

You definitely don't want to work for a company that sees you as a "cost"; they will "downsize" you in a heartbeat. 💔
Whereas working somewhere that understands that investing in tech can give a substantial ROI ...
You will be appreciated and compensated accordingly.

The companies that are using Zig are doing it for a reason; innovation in team + program performance. 🚀
They are the early adopters - who similar to early investors - make strategic investments that produce outsized returns!

@nelsonic
Copy link
Member Author

https://ziglang.org/learn/getting-started/

brew install zig

@ndrean
Copy link

ndrean commented Jul 16, 2024

Just a tip! You drop your image, and make your image clickable and direct it to the location by using [<the result of the drop-in>](https://the origin)

[<img width="1179" alt="Screenshot 2024-07-16 at 09 43 06" src="https://github.com/user-attachments/assets/cfdc4ce7-3c57-4fe9-88ff-d3f9f14aebb1">](https://www.google.com/search?q=youtube+elon+musk+fires&oq=youtube+elon+musk+fires&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIGCAEQRRhAMgYIAhBFGDwyBggDEEUYPNIBCDQ1NDJqMGo5qAIAsAIB&sourceid=chrome&ie=UTF-8#fpstate=ive&vld=cid:13572b4c,vid:YZWcC7CbOKQ,st:0)

@ndrean
Copy link

ndrean commented Jul 16, 2024

A non trivial and nicely written paper.

Screenshot 2024-07-16 at 11 35 14

@nelsonic
Copy link
Member Author

@ndrean
Copy link

ndrean commented Jul 21, 2024

A blog on/for Zig

Screenshot 2024-07-21 at 23 10 40

@nelsonic
Copy link
Member Author

Always find it interesting when a Programming Language uses Forem (Ruby on Rails) to power their blog/site ... 💭
zig-news-forem-ruby-on-rails
https://github.com/forem/forem

Clearly the goal was just to get started/going as quick as possible. :shipit:
And they aren't concerned about building the news site using Zig. 🦎

@nelsonic
Copy link
Member Author

"Zig came along and it just fixed everything that was wrong with C"
Joran Dirk Greef describing why he chose Zig for TigerBeetle:
https://youtu.be/ayG7ltGRRHs?t=2400
image
And gives far more safety [than Rust] including checked arithmetic.
"You want "checked arithmetic" enabled on mission critical systems ..."

@ndrean
Copy link

ndrean commented Sep 22, 2024

Learn - only - by doing?
Codeberg link to 104 small Zig exercises to start before anything else. They are similar to the Rust ones - which I did not tried:

Screenshot 2024-09-22 at 21 46 45

The guy that made the video below tells us to do theses exercises above. He gave the link, so as a good boy, I will execute. I will watch this once I am done with the 104 exercises 😄
Screenshot 2024-09-22 at 22 04 13

@ndrean
Copy link

ndrean commented Sep 25, 2024

A concise summary of the Zig language in this pdf: zig.key.pdf

Found here: (source)

Zig compiles C and C++ code:

Screenshot 2024-09-25 at 10 50 40

@ndrean
Copy link

ndrean commented Sep 29, 2024

❗ async functions are currently not implemented in Zig.
Version 0.13.

error: async has not been implemented in the self-hosted compiler yet

Screenshot 2024-09-29 at 18 26 01

@nelsonic
Copy link
Member Author

During the Q&A session, participants raised concerns about topics such as async functionality, tooling, internal compiler changes, and contributor engagement. Here are some highlights:

Async functionality: While acknowledging the appeal of async programming, Andrew explained that integrating it into Zig presents numerous technical challenges. Implementing custom code generation backends and debugging tools are among the obstacles requiring solutions before async becomes practical in Zig.

via: https://www.reddit.com/r/Zig/comments/1ac8nrf/zig_roadmap_2024_with_andrew_kelley/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants