Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
Araq
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
7 ms
·
1.
▲
by
Araq
8y ago
Support for embedded is indeed getting into focus. I hope to release an article soon how the '--gc:regions' switch works (which is misnamed, it's a way to do memory management, not a GC...) and in the longer run the destructo
2.
▲
by
Araq
8y ago
I agree that 'discard' is usually a code smell, but how would implicitly ignoring the result be any better? It wouldn't be better at all, and that means Nim's discard feature is rather well designed as it improves the st
3.
▲
by
Araq
8y ago
I'm not following you really. 'discard' is an enforced, explicit statement about that you throw away information/the result of a computation. That's against "nice if you are programming alone" as much as i
4.
▲
by
Araq
8y ago
That's true and I wouldn't use the Option type for that either. There is a switch that warns about variables that are not initialized explicitly (including the 'result' variable) and an RFC to make this switch non-option
5.
▲
by
Araq
9y ago
We're slowly getting there though. I hope to release a blog post soon about how it might look like in Nim.
6.
▲
by
Araq
10y ago
> But to ask a pointed question, doesn't that mean Nim gets the worst of both worlds? You have both the overhead of updating reference counts and the (relatively long) garbage collection pauses. There's a patch of the collector
7.
▲
by
Araq
10y ago
> There are other ways to address this issue. You can do what Swift does and call into libclang so that you can pull out the structure definitions, for instance. Sure and you only need to call libclang for each different platform. Or is
8.
▲
by
Araq
10y ago
Compiling to C vs using LLVM is a complex design tradeoff. For example, the Posix standard specifies a C interface. Quote: "The stat structure shall contain at least the following members..." This means you can wrap 'struct s
9.
▲
by
Araq
10y ago
Good questions. I'm afraid the documentation is seriously out of date about the GC: It used to implement a variant of "trial deletion" so that "never scans the whole heap" used to refer to the fact that it doesn
10.
▲
by
Araq
11y ago
> The manual even says that just calling printf is actually unsafe as the cstring could be GC'd (but it probably won't). The manual tries very hard to mention corner cases since it's evolving into a proper spec. Calling pr
11.
▲
by
Araq
11y ago
> And there's no strong sense of design and elegance. It very much comes off as "here's a bunch of ideas thrown together with the restriction that they all must somehow compile to C". But C is Turing-complete, so ther
12.
▲
by
Araq
12y ago
Shrug , you left out: - Conservative GC marking of the stack. - No stack overflow check in release mode. Compiling to C is not tricky, it is horrible and we don't do it for the fun of it! That said, clang has lots of options to tame C
13.
▲
by
Araq
12y ago
Well I did my homework. When you find another language that does it in a somewhat similar fashion, I'll happily change the website. ;-) I didn't think Rust counts, but since it's constantly changing, I will have a fresh look
14.
▲
by
Araq
12y ago
Disclaimer: I'm the lead designer of Nim. pcwalton's remark is excellent but "automated proof technology" is not a well defined term. What I mean by this is that it goes beyond what a traditional type checker can do. I d
15.
▲
by
Araq
12y ago
You cannot do these things easily currently since the assignment operator cannot be overloaded. There are ways around it, you can "fix" the broken builtin assignment with a TR macro, but since TR macros MUST not change semantics (
16.
▲
by
Araq
12y ago
Thanks for mentioning Nim! :-) I can't say I agree with anything you say though... So only memory safety is C's problem? Not its type system that's very weak in every aspect (not just memory safety)? Not its missing module sy
17.
▲
by
Araq
12y ago
As the primary author of Nimrod I disagree. ;-) And to be blunt: I know the person has no idea of what he talks about when he uses the word "transpile".
18.
▲
by
Araq
13y ago
Nimrod solved that... The solution in a nutshell: If a statement list contains a 'return', it enforces a 'void' context for the statement list, otherwise the statement list has the type of the tailing expression e in (s;
19.
▲
by
Araq
13y ago
(Disclaimer: I am the creator of Nimrod.) What you say is entirely correct; however Nimrod's effect system is not tied to any runtime mechanisms like a GC and provides lots of other aspects of safety. For instance you can ensure at com
20.
▲
by
Araq
13y ago
Strings should be converted to UTF-8 as part of input validation. For proper input validation we have the taint mode already. Note that often a file does not include any information about the encoding, so you can only use heuristics.
21.
▲
by
Araq
13y ago
This is very true; however c2nim distinguishes between #def and #define for this reason and this helps a lot. #def means c2nim needs to expand the macro, #define means it's some macro that should be translated into a Nimrod template. C
22.
▲
by
Araq
13y ago
It delivers? Lol. The GC used to suck for 32 bit systems and it still sucks for realtime. As opposed to Nimrod's which pretty much guarantees a maximum pause time of 2 milliseconds -- independent of the heap size. And that's only the start:
23.
▲
by
Araq
13y ago
Ok, lets see: UTF-16 strings encourage bugs with surrogates. Note that most C# and Java code is notoriously broken wrt those and yet I never hear anybody complain about it. UTF-32 strings roughly take up 4x more memory than UTF-8 strings an
24.
▲
by
Araq
13y ago
Hello everyone, I'm the designer of Nimrod. I will be glad to answer any questions regarding the language.