Hacker News new | past | comments | ask | show | jobs | submit | dinglejungle's comments login

This might be more of an indictment on 'readable' being a meaningful concept (beyond simple personal preference) than it is of Zig's syntax.


> Cookie Monster (includes Black Metal)

But what about Pterodactyl-fronted Black Metal: https://youtu.be/UZlZuYp1fZc?t=164



> Why would operator overloading allocate memory?

What if I wanted to overload the + operator to concatenate strings?


Yes that was poorly thought out. I realized it after i commented.

There is definitely some merit in being puritanical about not having any allocations in operators.


defer in Zig is per-scope, so

    {
        var file = try std.fs.cwd().openFile(path, .{});
        defer file.close();

        // ... code ...
        // file.close() is executed here
    }
would work just fine.


Yes, but look at the example in the blog post of this thread- "stat" depends on "file", "file" depends on "path". You can call defer in any order in your code, the language syntactically doesn't enforce you to call defer right after resource acquisition. "try-with-resources" in Java (or "using" in c#) will always call "finalizers" in order opposite to how resources where created. Following the syntax I inveted above, for someone used to Java it would be easier to read than to think how defers are called:

  try std.fmt.allocPrint(allocator, "problems/{}", .{ id }) |path| : allocator.free(path) {
    try std.fs.cwd().openFile(path, .{}) |file| : file.close() {
      try file.stat() |stat| {
        try allocator.alloc(u8, stat.size) |contents| : allocator.free(contents) {
          // do something with 'contents'
        }
      }
    }
  }
In Zig you can write this, and mess everything up:

  const path = try std.fmt.allocPrint(allocator, "problems/{}", .{ id });
  var file = try std.fs.cwd().openFile(path, .{});
  const stat = try file.stat();
  var contents = try allocator.alloc(u8, stat.size);
  defer allocator.free(contents);
  defer file.close();
  defer allocator.free(path);


That's what errdefer is for.


Yeah, judging from the MuseScore owners' behavior towards musescore-downloader, the situation with Audacity will only get worse from here.

https://github.com/Xmader/musescore-downloader/issues/5

https://github.com/Xmader/musescore-downloader/issues/42#iss...


Keep reading that issues/5 thread, especially the replies from Muse Group's Head of Strategy workedintheory. It doesn't explain this Audacity stuff, but the musescore-downloader response makes sense (TLDR: copyright holders forced them to add a paywall or remove non-public domain content).


That doesn't excuse the behaviour from MuseGroup. They essentially were trying to do same thing that rights holders tried to do to youtube-dl, with (somehow) even less standing, since MuseGroup does not even represent the rights holders in this case.

Fraudulent DMCA claims and scare tactics ("Information about users who use this extension on musescore.com will be shared with local police"[1]) are inexcusable regardless of how they are justified.

[1] https://github.com/Xmader/musescore-downloader/issues/42#iss...


Agreed on the police threats and DMCA attempt. They seem to have succeeded in getting it removed from the Chrome web store, due to its name violating MuseScore's trademark.


> They seem to have succeeded in getting it removed from the Chrome web store, due to its name violating MuseScore's trademark.

That can't be the reason, since the name "musescore-downloader" doesn't violate MuseScore's trademark. If you have a trademark, there is no prohibition on me using the mark to refer to you. Doing that is the whole point of your trademark.


But would it cause user confusion over whether the software comes from the same organization as MuseScore itself? Saying it’s just a reference doesn’t seem like it would get you off the hook that easily?

But in this case the maintainers of the Chrome Web Store get to decide. If they think it’s too close, it’s too close.


MuseScore tried to do a DMCA takedown on the project. Only the copyright holders themselves, or their legal representatives, can file those according to the law. MuseScore is not the copyright holder for tabs and scores they're asserting the project author is infringing on.


The comments on the original announcement here were pretty positive: https://news.ycombinator.com/item?id=27676266


The TortoiseGit client basically has this feature[1]. In the commit GUI, you can right click a file and select "Restore after commit", then you can edit the file to remove all the changes you don't want to commit (which means you can also test it, etc, and that your edits can be as granular as you want). Then, after you commit, it resets it to have all the changes you left out.

I like it a lot.

[1] https://stackoverflow.com/a/48788906


The company Elastic was created 2 years after the release of ElasticSearch.


And 6 years after the release of Elastic Compute Cloud.


From https://www.elastic.co/about/press/elastic-n-v-reports-stron...

> First Quarter Fiscal 2020 Financial Highlights

> Total revenue was $89.7 million, an increase of 58% year-over-year, or 62% on a constant currency basis.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: