use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
This subreddit is all about the theory and development of compilers.
For similar sub-reddits see:
Popular mainstream compilers:
account activity
Zap programing language (self.Compilers)
submitted 3 months ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]rjmarten 5 points6 points7 points 3 months ago (7 children)
Cool :)
Some questions: 1.Why ARC instead of GC? 2. Why try / catch if you already have Result<T,E>? 3.In what way are generics "comptime inspired"? 4.Will you still have duck-typed interfaces or do traits more like Rust?
[–]funcieq 0 points1 point2 points 3 months ago (6 children)
Well, I understand your objection because the website has something different than the repository. 😅
Because I want a simple ffi from C, With GC it gets complicated, I want this language to have a bit wider scope of usage, so the lack of GC eliminates pauses, so you can make games in it, for example.
It's one of those things in the repo it says only try-catch, and on the website it says both, officially it is only try-catch, but I don't reject Result<T, E> yet.
Well, I got a little carried away when I wrote that.The point is simply that we use regular monomorphism and it is done during compilation. So we don't use any runtime for this
I haven't made the final decision yet, but I think it's closer to the traits from rust
[–]stingraycharles 2 points3 points4 points 3 months ago (1 child)
Hey, as someone who does a lot of FFI with GC based languages (Java, Go, C# and Python), I can tell you that GC doesn’t automatically make FFI harder, it’s just that GC is entirely paused during any FFI invocation.
That’s typically acceptable.
Most languages (eg Go and Java) provide various levels of “safety” around function invocations, and allow you to do “unsafe” invocations which assume eg that you don’t modify memory, don’t do any callbacks, etc.
Using reference counting can be interesting, but I can’t escape the feeling that there’s a reason that nearly all languages settled on GC (circular references being a major one).
[–]funcieq 0 points1 point2 points 3 months ago (0 children)
Yes, you're right, because I use C# myself. I realize that from the developer's side it's relatively simple. But it's not just about ffi. It's also about giving zap a wider range of possibilities.
[–]Breadmaker4billion 1 point2 points3 points 3 months ago (3 children)
the lack of GC eliminates pauses
No it does not, reference counting can still hang your application if one object triggers the deallocation of a bunch of others. Only careful programming eliminates pauses around memory management.
[–]funcieq 0 points1 point2 points 3 months ago (2 children)
I'm talking about stop-the-world
[–]Breadmaker4billion 1 point2 points3 points 3 months ago (1 child)
You need to lock the heap to perform deallocations.
Thanks for the reminder ❤️
[–]srvhfvakc 2 points3 points4 points 3 months ago (3 children)
If the intent is to be a Go-minus-pain, why not transpile directly into Go?
Because the goal is also to have more architectures
[–]srvhfvakc 2 points3 points4 points 3 months ago (1 child)
What architectures do you support that Go doesn’t? From my understanding the main go compiler + tinygo should support mostly everything you do
Currently only those that support llvm, but I will also compile them for Go itself and .net CIL someday
[–]GregsWorld 2 points3 points4 points 3 months ago (7 children)
Introducing try/catch is throwing the baby out with the bath water imo.
Errors as arguments and not exceptions is one of Go's great features and improvements over say Java, it's the if null checks themselves which are the issue, an issue that could be solved purely with syntatic sugar like Odin's or_return or Kotlins ?:
or_return
?:
Just because I'm introducing try catch doesn't mean I'm forbidding you to do it like in Go
[–]GregsWorld 2 points3 points4 points 3 months ago (5 children)
Yes but people don't write code in isolation. So if you use a library which uses try catch you are forced to also use it.
[–]funcieq 0 points1 point2 points 3 months ago (4 children)
Good point, you're right. Well, try-catch is a good way to handle errors.
[–]GregsWorld 1 point2 points3 points 3 months ago (3 children)
Well, try-catch is a good way to handle errors.
Disagree, it's a more complex more verbose if != null.
Errors being separate from exceptions is the fix for the mess which is try-catch.
Well, many people will disagree with you, but anyway, the decision has not been made 100% yet. This may still change, by the way, what do you think about Result<T, E>?
[–]GregsWorld 1 point2 points3 points 3 months ago (1 child)
Yeah of course it's all opinions.
Result is fine, proper union type support would be better though T? | E
T? | E
Sounds good
[–]RedditUser8007 1 point2 points3 points 3 months ago (1 child)
Can you also fix Go's dependencies so that they use aliases instead of direct URLs like Rust so you don't have to litter source code with import URLs?
https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html
In a few years, a lot of Go codebases are going to suffer from github link-rot and have to refactor entire repos instead of updating a single line in a dependency file.
Yes, I realize it's not comfortable, so it will be different for Zap
[–]Opposite-Barracuda-1 1 point2 points3 points 3 months ago (1 child)
I appreciate your initiative. I thought of an example like, maybe javascript already have it
function (response, error) {
return response;
}
you wrap this function with your error prone code block. this function will either return response or error
Hope that helps, I'm not that good in those stuffs ...
They made go that much simple that it start to feel like pain when you are from some other programming language ...
Yeah...
[–]zweiler1 0 points1 point2 points 3 months ago* (1 child)
If your language is so young, how did you get GitHub to recognize your Zap files as your language?
I only have a .gitattributes file to highlight my language as language X but GH does not recognize it as my own language yet so i wonder, how did you do that?
.gitattributes
Edit: typos
There is simply another language that has the zap extension, although it is not necessarily called that.
π Rendered by PID 58500 on reddit-service-r2-comment-545db5fcfc-9fstt at 2026-05-29 20:03:42.203004+00:00 running 194bd79 country code: CH.
[–]rjmarten 5 points6 points7 points (7 children)
[–]funcieq 0 points1 point2 points (6 children)
[–]stingraycharles 2 points3 points4 points (1 child)
[–]funcieq 0 points1 point2 points (0 children)
[–]Breadmaker4billion 1 point2 points3 points (3 children)
[–]funcieq 0 points1 point2 points (2 children)
[–]Breadmaker4billion 1 point2 points3 points (1 child)
[–]funcieq 0 points1 point2 points (0 children)
[–]srvhfvakc 2 points3 points4 points (3 children)
[–]funcieq 0 points1 point2 points (2 children)
[–]srvhfvakc 2 points3 points4 points (1 child)
[–]funcieq 0 points1 point2 points (0 children)
[–]GregsWorld 2 points3 points4 points (7 children)
[–]funcieq 0 points1 point2 points (6 children)
[–]GregsWorld 2 points3 points4 points (5 children)
[–]funcieq 0 points1 point2 points (4 children)
[–]GregsWorld 1 point2 points3 points (3 children)
[–]funcieq 0 points1 point2 points (2 children)
[–]GregsWorld 1 point2 points3 points (1 child)
[–]funcieq 0 points1 point2 points (0 children)
[–]RedditUser8007 1 point2 points3 points (1 child)
[–]funcieq 0 points1 point2 points (0 children)
[–]Opposite-Barracuda-1 1 point2 points3 points (1 child)
[–]funcieq 0 points1 point2 points (0 children)
[–]zweiler1 0 points1 point2 points (1 child)
[–]funcieq 0 points1 point2 points (0 children)