unhandled exception: index -1 not in 0 .. 12 [IndexDefect]

2024-01-13 Thread janAkali
Just to expand on Araq's answer. It doesn't look like this defect is raised by a `for loop`, because in Nim, in case where right boundary is less than left e.g. `0 .. -1` loop block would never run: let zero = 0 let c = zero for i in 0 .. c - 1: echo "You would never s

A cost model for Nim v2

2024-01-13 Thread Isofruit
That made me curious on your perspective on Result types ala Rust (I think Go has that idea as well but I haven't written a single line of code in it, so no clue). During my brief stint with the language 2 years ago it seemed like a pretty neat idea, like enforcing annotating everything with Ra

unhandled exception: index -1 not in 0 .. 12 [IndexDefect]

2024-01-13 Thread Isofruit
Even _if_ syntax sugar were available I would recommend the more verbose approach, simply for clarity. let matchCount = customregex() # return number of matches let hasMatches = matchCount > 0 if hasMatches: for i in 0 .. matchCount: Run This would honest

Dynamic Typing in Nim

2024-01-13 Thread Araq
It didn't "came back". It never went away.

unhandled exception: index -1 not in 0 .. 12 [IndexDefect]

2024-01-13 Thread namisboss
A defect is designed to show a coding/logic error and is not intended to be caught. If you still want to raise an exception, you can check for -1 and the intentionally raise some other exception that you can catch. Alternatively you could probably wrap the whole code chunk in an if statement `if

A cost model for Nim v2

2024-01-13 Thread Araq
Exceptions have been part of Nim from day one and since then have been tamed with `.raises` annotations and inference. There is no article justifying the design decision because back then it was state of the art. And it still is btw because the alternatives are worse. Performance is not the rea

unhandled exception: index -1 not in 0 .. 12 [IndexDefect]

2024-01-13 Thread Araq
> Thus when zero matches (a rare condition) it ends up as 0..-1 and causes the > exception Why would it? The loop would not be run.

Absytree: Text editor (and tree based language framework) in Nim

2024-01-13 Thread nimaoth
What's currently implemented is a basic projectional editor, where the AST gets converted to another tree (cell tree) which can be rendered and edited. The edits to that get applied to the underlying AST. There's currently no advanced projections like e.g. tables or color pickers, but it can re

unhandled exception: index -1 not in 0 .. 12 [IndexDefect]

2024-01-13 Thread stbalbach
Sometimes my program aborts with fatal.nim(49)sysFatal Error: unhandled exception: index -1 not in 0 .. 12 [IndexDefect] Run I am not handling range exceptions correctly, it is a two part question: how to trap exceptions of this type and, how to determine wh

Swift, Godot and c/c++ interop

2024-01-13 Thread nasl
Seems like all the arguments for Swift for Godot are also arguments for Nim:

Dynamic Typing in Nim

2024-01-13 Thread pietroppeter
Somewhat relevant to the discussion, a nice presentation by Richard Feldman: [Why Static Typing came back](https://youtu.be/Tml94je2edk?si=nMQfJa7_JJT4mQPF)

A cost model for Nim v2

2024-01-13 Thread 3-2-1
That was a good read. Do you have any more articles you can point me to that explain your design choice of using exceptions rather than monads or even fancier concepts? Is it largely the performance benefits you've argued for here? I've found exceptions to be problematic from a spooky-action at

Absytree: Text editor (and tree based language framework) in Nim

2024-01-13 Thread nasl
@nimaoth I just noticed that you mentioned as the inspiration. Their ideas are great - can you say more about features you have implemented or planning to? Also, in the future, is the smooth scrolling going to be a possibility?

Malebiotix CBD Gummies Canada Reviews for Male Specialists!

2024-01-13 Thread jounaror
Malebiotix CBD Gummies Canada Surveys for Male Upgrade Uncovered by Clinical Specialists of USA! ✅➽➽=> Click Here To Buy Now At Official Website [Limited Stock] <=✅✅➽➽ ✅✅Your payment is 100% secure and there are no extra charges✅✅