HNHacker News
TopNewBestAskShowJobs

kreco

324 karma · joined January 26, 2018

submissionscomments
kreco··on Interview with Zig language creator Andrew Kelley [video]
Yeah, that's actually how any C FFI bindings should be.

Ans also, that's the strength of C and its simple ABI.

kreco··on Show HN: A compiler for a small language into x86-64 assembly
Sorry I won't be able to give you a lot of feedback.

As a matter or preference I really like colons and semi-colons.

That said your work is amazing. This is a true example of simplicity. I don't think most of people would get how difficult it is to keep it simple.

Everything is clear I can read the source code without asking myself "what is that", everything makes sense.

Thanks for presenting your work.

Do you have any constraints, like "no meta programming", "generated library should be as much as possible compatible with C", "it should have one pass optimization" or even "the compiler must be embeddable in most place as possible" ?

kreco··on Better C – A subset of D Programming Language
> Also, we used to publish benchmarks. These inevitably did not produce illumination, but long ripostes from people arguing that the benchmark was unfair, inaccurate, nobody would write code that way, we sabotaged other languages, etc.

Oh, this is pretty sad...

Anyway thanks for your time. Was nice to interact with the author of D. I truly believe what you've done will inspire a lot of people.

I hope you didn't encounter too many people saying creating D was foolish.

I spent time checking about a lot of languages and only D (and Jai, but it's not released) would restore my joy of programming.

kreco··on Better C – A subset of D Programming Language
I'm not interested in spending time fixing something that is not considered broken by someone else. They are not bugs that have been introduced by mistakes.

Don't get me wrong, I like to help people. But I learnt to not help people that do not seek help.

You get a plumber fixing your pipes because you need your pipes to be fixed, but if every single plumbers were offering there help it would be annoying.

There are already more that three hundreds proposals:

https://github.com/ziglang/zig/issues?q=is%3Aissue+is%3Aopen...

A lot of them are about the syntax. Maybe this won't be endless but I'm sure a lot of time are being wasted. The root of the issue I point seems to be bound to the way the devs are working. Not sure if it will be efficient to tell them to "think more carefully". I do believe my time can be more profitable elsewhere (like commenting here, ah ah).

kreco··on Better C – A subset of D Programming Language
Yes, I can see the design of D was made carefully.

D is actually a great language. I just "don't understand" why it's not massively used instead of more recent versions of C++, I consider newer version of C++ as a totally different language with more drawbacks than advantages. Half of new features are present to fix previous half baked features. This is quite embarrassing.

Sorry for my selection of words (and for the unrelated opinion, I had to rant), I'm not good at spending time to rephrase when the end content is the same.

I remember one time I spent the whole day browsing the website of D, everything actually make sense. There are still features that I wouldn't use, but this is what I expect from a programming language design. I was impressed by a lot of decisions.

I seemed to remember that I was a bit sad to not find proper performance benchmarks against other languages. I was intrigued because the documentation was so complete, it was just lacking this (maybe I just couldn't find them). It was a long time ago so it has probably been fixed. I will give it a try at some point.

kreco··on Better C – A subset of D Programming Language
Thanks for spending your time explaining this. I think a lof people will understand those lines better.

I actually already knew everything. I watched closely the development of Zig, and just give up when I realized all those decisions where made carelessly in my view or I just simply disagree with the direction of the syntax.

Since you took your time I will take mine to address what I don't like:

- There is no way to write "int" by default. I understand why. But I don't agree.

- struct and enum statements (within braces) are separated by a comma which is inconsistent with statements in function separated with ",". In my view expect a difference between parameters and statements. parameters (a,b,c) statement {a;b;c}

- You have to type "var" or "const" everywhere, but not in struct statement and enum statement. Sometimes it's like a "def" sometimes not.

- You have to type const when importing module:

  const std = @import("std"); // Why ? Why should I specify const, this should be inferred. Same when I define a struct. 
- the "undefined" keyword when it means "uninitialized" even in the documentation.

  var my_var: i32 = undefined;
- The worst, no default values for struct.

- The list of keywords is insane: errdefer, allowzero, orelse, unreachable, anyerror

- About iterator I was doing well with:

  while(get_next(context,  &item)) { /* ... */ }
It's like everything has been carefully design to be even less readable than C code. I have the feeling that the syntax help more the compiler than de developer.

I wish I could bet thousands of dollars that there will be only one compiler in the whole life of Zig language (also because it relies way too much to LLVM).

kreco··on Better C – A subset of D Programming Language
Thanks for your comment. It's pretty normal to face this downvotes when talking about language. And my phrasing was not the most kind of all.

It's just the CS community, at some point when you are writing languages you tend to try to outsmart the language you are fixing by creating overly complex behavior. Over-engineering is every single new languages.

Even Zig fails to do better than C, I think it's syntactically a disaster.

Here is a few lines from the documentation:

  const ptr = @intToPtr(?*i32, 0x0);

  while (it.next()) |item| { /* ... */ }

  pub fn main() anyerror!void { /* ... */ }

  exe.addCSourceFile("test.c", [_][]const u8{"-std=c99"});

  const file = std.fs.cwd().openFile("does_not_exist/foo.txt", .{}) catch |err| label: { /* ... */ }
kreco··on Better C – A subset of D Programming Language
I'm actually curious. until now I came across new language that sells themselves as c replacement but with a lot and lot of new features, usually "here is a new language it does a lot more than C but still compatible with it".

examples in top of my head:

- adding object oriented feature like built-in constructor/destructor while only default values are needed as week as a defer statement.

- weird template, while I can sense that we only want a proper hygienic macro system.

And "array type", pointer with length, to deal with contiguous memory.

The rest is well described in the video, but those 3 points are my major issues.

kreco··on Better C – A subset of D Programming Language
It's interesting how this works:

- enumerate everything C is doing bad.

- presents fixes with a full bag of unnecessary features that no c programmer wants.

I wonder why there is no "Fixed C".

kreco··on Show HN: Beef, a new performance-oriented programming language
A "perforance-oriented" language without benchmark. That's something.
kreco··on When XML Beats JSON: UI Layouts
Following what you say we should only have binary format.

I think you underestimate the convenience of a text format.

It does not only provide a simple way to generate it, but also provide a way to modify it by hand.

kreco··on Efficient string copying and concatenation in C
> For one thing how big (sizeof) should the length prefix be? 16-bits? 32-bits? 64-bits?

Exactly like what is returned by strlen... ?

kreco··on Tetris clone written in Zig running on WebGL and WebAssembly
Wow, that's great!

I'm following you on Github then.

kreco··on Tetris clone written in Zig running on WebGL and WebAssembly
Great work, I wanted to know a way to play with WebAssembly and Zig. This is perfect.

Do you know how easy/difficult would it be to make a desktop version of it ?

One of my long term goal is to make it cross platform.

kreco··on Unnecessary medical care is harming patients physically and financially (2015)
Really interesting, thx !
kreco··on Unnecessary medical care is harming patients physically and financially (2015)
For the physical harming, Nassim N. Taleb wrote a book called "Anti-Fragile" desribing the concept of iatrogenic illness.

https://en.wiktionary.org/wiki/iatrogenic

An alarming fact was less dying patients when an hospital workers were in a strike action (during 2 weeks).

kreco··on Some obscure C features
You should combine "__COUNTER___" with "before_after_##__LINE__" to make a unique identifier more robust.

Your snippet won't work with this inline example:

  before_after("hello", "world") { before_after("hello", "world") { }}
← PreviousPage 6 of 6