Advanced Compilers: Self-Guided Online Course

2023-03-13 Thread jasonfi
I saw this on HN and thought it might be useful for the compiler team and those interested in learning more about compilers: HN discussion:

Can I type a parameter as supporting `$`?

2023-03-13 Thread ElegantBeef
I do also have a writeup that briefly explains them but it's no clue the amount of help it offers

Can I type a parameter as supporting `$`?

2023-03-13 Thread etra0
I also found [this section](https://nim-lang.org/docs/manual_experimental.html#concepts) of the experimental features to do a good job explaining what concepts are.

Can I type a parameter as supporting `$`?

2023-03-13 Thread noah
recommend surfacing `concepts` in the docs I checked the * manual: ) * compiler user guide: ) but didnt find it until i checked [the index](https://nim-lang.org/docs/compiler/theindex.html)

Make Nim docker images official?

2023-03-13 Thread treeform
I also would like to have a "green official badge." Its always an uphill battle to get Nim adopted and used at large organizations. The green badge will remove a little bit of friction.

Can I type a parameter as supporting `$`?

2023-03-13 Thread ElegantBeef
With a concept: type Stringable = concept s `$`(s) is string proc doThing(s: Stringable) = echo s doThing(100) doThing("hello") type NewType = distinct int assert not compiles(doThing(NewType(100))) Run

Example of simple parser?

2023-03-13 Thread zevv
might fit your needs.

Can I type a parameter as supporting `$`?

2023-03-13 Thread SuaveSteve
I have a proc that only cares a parameter can be passed to `$`. How can I type this?

why use nim over c#?

2023-03-13 Thread mx1990
thank you for your reply and i agree. i think the level of abstraction in c# may be too high for my liking. i know that sounds like a weird thing to say but i cant describe it any other way i think i may have been too hard on c# in my previous post. it's a really nice language for what it is bu

try-catch misbehavior

2023-03-13 Thread inv2004
@arnetheduck1h I agree, it is v1 I mentioned, except that probably safe `[]` should be default, but `{}` is not. But I do not think that it is good if everyone will write own `{}` implementation On another hand I changed my mind a bit. Because it means that code will have `[]` and `{}` but it d

try-catch misbehavior

2023-03-13 Thread arnetheduck
In our production code handling errors matters, we do something similar, but instead use [nim-result](https://github.com/arnetheduck/nim-result), so your call-site decides what to do with out-of-bounds: raise a defect, pass on to the next stack frame or raise a catchable, keeping the "access" AP

try-catch misbehavior

2023-03-13 Thread arnetheduck
Another option is to simply define a function called `proc {}(v: seq, i: int) = if i >= v.len: raise (ref ValueError)(msg: "out of bounds") else: ...` then use it like `v{i}`: this raises a regular catchable error meaning you can keep catching it with `except CatchableError`.

try-catch misbehavior

2023-03-13 Thread inv2004
One more question: If I uses someone's lib and p:on and it fails on bounds - how can I catch it in my app except turn everything back to p:on?

try-catch misbehavior

2023-03-13 Thread inv2004
@Araq The `indexErrors:on` is about v2, but looks like it will go into many libs instead of automatic switch by p:on|off, that if why probably safe `[]` and `unsafe[]` looks a bit better

why use nim over c#?

2023-03-13 Thread kobi
With C# you have a ceiling of high-level code - a ceiling of abstraction, on the other side you have a floor you can't break - you cannot go too low-level either. In C# you will have to use reflection or annotations or something horrible as that, to go further, and it is really really really slo

try-catch misbehavior

2023-03-13 Thread inv2004
The thing I do not like about the code: It is just suppress the warning about bare-except, but if I try to compile with `--panics:on` another day - the warning will be still suppressed and I will find the program fails. I think I would prefer to see the warning only if p:on. The same example is

try-catch misbehavior

2023-03-13 Thread Araq
Most of these 41 lines would not be affected either way (i.e. keep working with --panics:on) afaict, but it's a fair point. Arguably it's broken code though as it doesn't work under `-d:danger`.

Example of simple parser?

2023-03-13 Thread Hlaaftana
Well what I thought first was `if s[i] != '(': someError()` and the simplest way to error that came to mind was `assert false`

Announce: LimDB, a fast, persistent table with LMDB under the hood

2023-03-13 Thread SerjEpatoff
Hmm, very interesting, thank you. Key paragraph from text: _LMDB is also append-only, meaning it only writes new data, it doesn’t overwrite existing data. Beyond that, nothing is ever written to disk in a state which could be considered corrupted. This makes it crash-proof, after any terminatio

try-catch misbehavior

2023-03-13 Thread inv2004
The thread gave an good example - sometimes I just want to catch any catchable _[including](https://forum.nim-lang.org/postActivity.xml#including) IndexError like it was before, from the point looks like I have to add if `i notin v.low..v.high: raise` in many places to cover it or implement my o

Example of simple parser?

2023-03-13 Thread xigoi
> `if s[i] != '(': assert false` Why not `assert s[i] == '('`?

Why does Nim compiler allways depends on another's language compiler?

2023-03-13 Thread auxym
IAR and Keil are mostly used with ARM cortex-M, which Nim supports very well via arm-none-eabi-gcc. In fact, exactly thanks to Nim's piggybacking on gcc, Nim supports many embedded targets including ARM (many versions, including stuff like GBA and Nintendo Switch), RISCV, AVR and MIPS. Would th

try-catch misbehavior

2023-03-13 Thread Araq
**Note** : My reply refers to index checking only. And only to single element indexing, not slices. >From the beginning of Nim array/seq index checking was only supposed to be a >debugging aid. Correctly written code should not depend on it and the past the >release mode turned off the bounds c

Example of simple parser?

2023-03-13 Thread Hlaaftana
This is the pattern I usually go for for dead simple parsers. Here is an example for an extremely limited version of S-expressions with only lists, integers and atoms: type SexpKind = enum List, Integer, Atom Sexp = object case kind: SexpKind of L

try-catch misbehavior

2023-03-13 Thread inv2004
It is still unclear - does it mean we have to check all ranges manually from now? I understand the point with panics:on|off, but most of the Nim's code I see is not low-level and rely on checks and panics which makes nim easy to write. If Nim's moves from it - it became more C/Rust language. Bu

Example of simple parser?

2023-03-13 Thread auxym
In case you weren't aware, Crafting Interpreters is a great book and freely available online: It gently walks you through writing a parser (and later an interpreter) for a java-like language using recursive descent (with code in java) and Pratt parsing (in C)

Ellen DeGeneres Keto Gummies - Do KetoPink Gummies Work Or Fake Scam Brand?

2023-03-13 Thread BilGagnon
Dischem Keto Gummies South Africa Do you feel like you've been fighting additional muscle versus fat uphill this time? What's more, would you say you will check normal techniques out? The open door this article gives is huge if so. Disposing of difficult fat stores like stomach fat, greasy arms,

Example of simple parser?

2023-03-13 Thread choltreppe
you could give [parlexgen](https://github.com/choltreppe/parlexgen) a try. Its maybe a bit overkill but you definatly get simple code, and a simple way to generate usefull error messages for illformed inputs.

Example of simple parser?

2023-03-13 Thread alexeypetrushin
Need to write parser for custom document format (similar to rdoc/markdown/yaml, with custom blocks), and it's a good opportunity to better learn parsers. Is there a short and clean example of parser in Nim? There are many parsers written in Nim, but they have different goal - performance and low

Why does Nim compiler allways depends on another's language compiler?

2023-03-13 Thread Araq
We don't target the C/C++ standards though but the concrete implementations clang, gcc and msvc and we exploit their language extensions. The standards also keep changing. And yes, the C standard does change too and often in subtle ways. Still, the situation is not too bad. But I'm happy we als

Announce: LimDB, a fast, persistent table with LMDB under the hood

2023-03-13 Thread radsoc
LMDB is a special beast. Read [this blog post](https://blog.cloudflare.com/introducing-quicksilver-configuration-distribution-at-internet-scale/) from Cloudflare: > LMDB stability has been exceptional. It has been running in production for > over three years. We have experienced **only a singl