Author Topic: Forget about python! Next hype will be Zig.  (Read 2397 times)

0 Members and 1 Guest are viewing this topic.

Offline madiresTopic starter

  • Super Contributor
  • ***
  • Posts: 8177
  • Country: de
  • A qualified hobbyist ;)
Forget about python! Next hype will be Zig.
« on: March 12, 2023, 02:21:19 pm »
See for yourself: https://ziglang.org/
 

Offline artag

  • Super Contributor
  • ***
  • Posts: 1249
  • Country: gb
Re: Forget about python! Next hype will be Zig.
« Reply #1 on: March 12, 2023, 02:25:35 pm »
"No preprocessor, no macros."

Why is that an advantage  ?
You could write C without any preprocessing but I can't see why you'd do that. It's pretty useful.
 
The following users thanked this post: Siwastaja

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4247
  • Country: gb
Re: Forget about python! Next hype will be Zig.
« Reply #2 on: March 12, 2023, 04:14:05 pm »
"No preprocessor, no macros."
Why is that an advantage  ?
You could write C without any preprocessing but I can't see why you'd do that. It's pretty useful.

well, in C people abuses so much of cpp and fill so many kind of crap into #define' that it usually ends makeing the ICE confused, the code not passing any QA, and debugging sessions a bloody hell ...

... and I was so tired that "#define" (and the whole cpp-stuff) was the first thing I removed in my-c, at the cost of making "my-c" like a "schoolmarm" who properly educates my colleagues to avoid spending my time cleaning up their code  :D

You can still use #define in my-c but only to define the size of an array, and if you use it then your code is not classified as level{1..4}(1) but rather as level{5} (C89/C99 legacy).

Code: [Select]
#define macro(a,b,c) .....
#define dbg_printf printf
#define foreach ...
etc
refused

Code: [Select]
#define my_array_size 1024
uint8_t my_array[my_array_size];
accepted, but the code is forced as level{5} (you cannot use advance my-c features, only C89 legacy ones)

So, array size by #define is accepted, other uses are banned, alias by different word defined, macros with parameters are recognized but the front end passes them to an "insult-engine" back-end I have implemented into the compiler (built-in, you cannot disable it by any flag) to better promote the cessation and cessation of bad coding attitude.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline artag

  • Super Contributor
  • ***
  • Posts: 1249
  • Country: gb
Re: Forget about python! Next hype will be Zig.
« Reply #3 on: March 12, 2023, 04:46:31 pm »
I don't find that to be a good argument, but OK, it's your view.

For your one 'OK' usage, why would you not use const ?

If people 'abuse' cpp, it's because they want to do something otherwise difficult. If you take away that facility they will write worse code, find a worse way to do it, or use a less restrictive language. Of course, people will also abuse it. That's what coding standards are for.

Python is a great example of how this backfires. Forcing a one-size-fits-all layout just makes it impossible to use layout as an aid to understanding. Poor codewriters still write hard-to-read code in python.

One thing I like to use the preprocessor for is to create tables of values that are all derived from some common input. Alternatives would be runtime initialisation (causing slow startup - like many PC programs) or an external code-generator to produce them (so now you've got an infinite variety of preprocessors, according to taste).

You could argue that the comptime features can do that function. And they may be attractive. But, requiring emulation of the target processor, they seem a very expensive way of providing a more capable (and, therefore, abusable) compile-time-processing feature. One could use them to perform exactly the operations described as unpermitted in the preprocessor.


« Last Edit: March 12, 2023, 05:01:46 pm by artag »
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11780
  • Country: us
    • Personal site
Re: Forget about python! Next hype will be Zig.
« Reply #4 on: March 12, 2023, 04:57:07 pm »
Zig existed for a long time, and I don't see it becoming popular. They don't even have for loops and religiously argue that they are not necessary.

And it provides no advantages on top of C. They just removed a bunch of stuff they did not like and shuffled the syntax a bit.
Alex
 
The following users thanked this post: neil555, I wanted a rude username, metertech58761

Offline Ed.Kloonk

  • Super Contributor
  • ***
  • Posts: 4000
  • Country: au
  • Cat video aficionado
Re: Forget about python! Next hype will be Zig.
« Reply #5 on: March 12, 2023, 04:57:47 pm »
Seems to me the underlying problem is (someone else's) code not being well enough commented. I don't know if yet another language is the answer.
iratus parum formica
 
The following users thanked this post: pcprogrammer

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15439
  • Country: fr
Re: Forget about python! Next hype will be Zig.
« Reply #6 on: March 12, 2023, 08:23:44 pm »
Zig existed for a long time, and I don't see it becoming popular.

Yes, I don't see what the point of the OP was here? It's absolutely not new. Zig was first released in 2015.
I guess he just found out about it and wanted to let us know.

And, I think you're being a bit harsh about Zig - there's actually significant stuff to be liked. But I still wouldn't use it.

It circles back to the other recent discussion about languages in the Microcontroller section.
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4247
  • Country: gb
Re: Forget about python! Next hype will be Zig.
« Reply #7 on: March 12, 2023, 08:44:56 pm »
They just removed a bunch of stuff they did not like and shuffled the syntax a bit.

So it was my-c, at the beginning.
Give them time and you'll see where it goes  :D
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15439
  • Country: fr
Re: Forget about python! Next hype will be Zig.
« Reply #8 on: March 12, 2023, 08:58:10 pm »
They just removed a bunch of stuff they did not like and shuffled the syntax a bit.

So it was my-c, at the beginning.
Give them time and you'll see where it goes  :D

I'm not particularly advocating it, but have a look at it instead of having preconceptions and not actually knowing what it is.
It has already gone pretty far.
 

Online coppercone2

  • Super Contributor
  • ***
  • Posts: 10842
  • Country: us
  • $
Re: Forget about python! Next hype will be Zig.
« Reply #9 on: March 12, 2023, 09:12:03 pm »
take off every zig

« Last Edit: March 12, 2023, 09:14:07 pm by coppercone2 »
 
The following users thanked this post: metertech58761

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4247
  • Country: gb
Re: Forget about python! Next hype will be Zig.
« Reply #10 on: March 13, 2023, 12:11:32 pm »
One thing I like to use the preprocessor for is to create tables of values that are all derived from some common input. Alternatives would be runtime initialisation (causing slow startup - like many PC programs) or an external code-generator to produce them (so now you've got an infinite variety of preprocessors, according to taste).

external tools must generate code for my-c, so data-type and error-flow are always checked at compile time, and you know which level{1..5} of code they generate, so you can accept or reject.




The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 4247
  • Country: gb
Re: Forget about python! Next hype will be Zig.
« Reply #11 on: March 15, 2023, 10:12:58 am »
What do you like about Zig?  :D
« Last Edit: March 16, 2023, 11:45:05 am by DiTBho »
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15439
  • Country: fr
Re: Forget about python! Next hype will be Zig.
« Reply #12 on: March 19, 2023, 03:20:41 am »
What do you like about Zig?  :D

What do you not like about Zig? Not a trick question nor a way to imply that it's all great. Just a genuine question, it's always better to discuss concrete points.
You can have a look there to see for yourself, if you haven't already: https://ziglang.org/documentation/master/

I think there's a bunch of interesting improvements over C. The comptime stuff is not bad. The syntax - it's ok, it looks obviously heavily inspired by Rust's syntax. Getting rid of the "inverted" C syntax, to get something closer to Wirthian languages, is not bad thing IMO. There's also nice stuff in terms of pointers, vectors, handling of undefined behavior, and the type system in general. The 'defer' construct is obviously handy as well - something we always more or less emulated with ad-hoc constructs in other languages. And, probably a lot more I'm missing.

Now is that enough to switch to a new language? That's always the question.
I personally wouldn't switch, if just because, as with many other newer languages, there is no standard, the language is not clearly defined (if you look at the documentation above, you'll notice that most features are described with examples rather than with text with a clear description and a clear definition), and what makes up the language is really the compiler, which is something I don't like and don't trust. Until you release at least a well-written, and ratified report, it's almost impossible to write another compiler for the language.

Note that these points are not specific to Zig. Almost all new languages suffer from this problem. To me, that's a no-go.
While it's obvious that it will take time before a recent language can get its own ISO standard, one can at least write a fricking language report, ratified by a board of maintainers.
"The compiler is the language", with funky accompanying documentation and a bunch of tutorials, is a major mistake from my POV.

Other than that, Zig has a few interesting features, and contrary to some other new languages like Rust, at least it's not opinionated to the point of near-schizophrenia.

And so, with all that said, no, it won't be the next hype. I could bet some good money on that one.

All in all, even if one has no intention to ever use it, it's always interesting to have a look at it, just like it's interesting to have a look at many other languages, past and modern ones.
Even if just to see what you really wouldn't like in a programming language.
« Last Edit: March 19, 2023, 03:25:10 am by SiliconWizard »
 
The following users thanked this post: newbrain, DiTBho

Offline bitwelder

  • Frequent Contributor
  • **
  • Posts: 973
  • Country: fi
Re: Forget about python! Next hype will be Zig.
« Reply #13 on: March 21, 2023, 09:20:51 am »
Zig existed for a long time
and still
Latest Release:  0.10.1

Eh, ok. What itches is it designed to scratch?
 

Offline Retep

  • Regular Contributor
  • *
  • Posts: 102
Re: Forget about python! Next hype will be Zig.
« Reply #14 on: March 21, 2023, 09:52:44 am »
I wouldn't consider Python a hype considering it has been around for about 30 years.

Professionally I have to deal with quite a few programming languages, and after several decades I've seen quite a few come and go. The success of a programming language does not so much depend on the qualities of programming language itself, but more on the ecosystem around it:
- Availability and quality of tooling (compilers, debuggers, IDE...etc.)
- Available libraries
- Documentation
- Supported platforms
- Size of the community (if only very few people use it it will likely die a silent death)
- Availability of support (commercially, forums...etc.)
- Availability of developers (claim to be) proficient with the language
- Availability of courses
- ...etc.

All that determines much more a how quickly one can realize an idea than the specifics of the programming language itself.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 20768
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Forget about python! Next hype will be Zig.
« Reply #15 on: March 21, 2023, 10:03:54 am »
Professionally I have to deal with quite a few programming languages, and after several decades I've seen quite a few come and go. The success of a programming language does not so much depend on the qualities of programming language itself, but more on the ecosystem around it:
- Availability and quality of tooling (compilers, debuggers, IDE...etc.)
- Available libraries
- Documentation
- Supported platforms
- Size of the community (if only very few people use it it will likely die a silent death)
- Availability of support (commercially, forums...etc.)
- Availability of developers (claim to be) proficient with the language
- Availability of courses
- ...etc.

All that determines much more a how quickly one can realize an idea than the specifics of the programming language itself.

That's not a bad list and conclusion.

I'll add that for me a key question is whether a new tool (kitchen, garden, electronic, software, etc) enables me to do something better than an existing tool. If not, why bother to switch?

A key topic that has been becoming important for a couple of decades, and is now obvious to most people, is parallelism in the form of multiple cores/processors with complex memory hierarchies (caches, NUMA, etc). Given that environment, how is Zig better than existing tools?
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline radiolistener

  • Super Contributor
  • ***
  • Posts: 4064
  • Country: ua
Re: Forget about python! Next hype will be Zig.
« Reply #16 on: April 15, 2023, 10:23:17 am »
If you want to use programming language for more robust code than C, there is a Rust. For a sweet debugging and code analysis there is C#. For a browser there is JS.

Of course there are a lot of other languages, but in many cases they are not required, because you can write code in C :)

 
The following users thanked this post: Ed.Kloonk

Offline retiredfeline

  • Frequent Contributor
  • **
  • Posts: 572
  • Country: au
Re: Forget about python! Next hype will be Zig.
« Reply #17 on: April 15, 2023, 10:45:00 am »
I'm holding out for Zag.  :-DD
 
The following users thanked this post: newbrain

Offline AndyBeez

  • Frequent Contributor
  • **
  • Posts: 858
  • Country: nu
Re: Forget about python! Next hype will be Zig.
« Reply #18 on: April 15, 2023, 11:28:43 am »
Code: [Select]
#define REPLY "The are a lot of languages designed for beginners. But experienced programmers require detailed syntax that does not treat them like they are a newbie teenager at code camp 101."

var controvesy string = $REPLY

« Last Edit: April 15, 2023, 11:30:38 am by AndyBeez »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf