Going from 2.0.6 to 2.0.8 & errors

2024-07-11 Thread drkameleon
As an update of the above, I tried the exact same thing you suggested and I kept getting an issue related to the type of `tmp`. Then, I decided to convert out `push` into a _proc_ (I had it as a template, which I have totally-abused admittedly)... and it works fine again! Sure thing is we'll ha

Going from 2.0.6 to 2.0.8 & errors

2024-07-11 Thread drkameleon
Great catch! I didn't even pay attention to that commit! Thanks!! And thanks a lot for the ultra-detailed explanation! :) I will experiment a bit with what you suggested and will let you know! Really appreciated!

Going from 2.0.6 to 2.0.8 & errors

2024-07-11 Thread drkameleon
You do have a point. Judging by the title of the commit, yes. But given that I didn't see anything specific, and given that the main differences in the generated C code have to do with that, I guess I forgot about the title... I'll have another look ;)

Going from 2.0.6 to 2.0.8 & errors

2024-07-11 Thread drkameleon
Well, the not-so-sound logic of: I was trying to figure out why 100 unit-tests were failing, I spotted this one bit, commented it out and - since everything(?) was working like before again - decided to figure out why... What you mention regarding the commit log, that's exactly what I've been l

Going from 2.0.6 to 2.0.8 & errors

2024-07-11 Thread drkameleon
It obviously make sense. As for the coding style, I obviously think it was quite sketchy, especially in the implementation of this particular command. But, let's see... Thanks! :)

Going from 2.0.6 to 2.0.8 & errors

2024-07-10 Thread drkameleon
I've been banging my head against the wall for the past few days trying to figure out what is going on with 2.0.8 that has so badly messed up our unit-tests. This is an example diff of the generated code in one of the suspicious points (the code on the left is produced by 2.0.6 while the code o

Super-weird error with builds on latest Windows runner (Github)

2024-05-18 Thread drkameleon
This actually did the trick, without having to resort to pulling the devel branch. Thanks a lot guys! You've saved me a lot of head-banging-against-the-wall lol (Not to mention that whenever I see (yet another) Windows-related issue, I'm on the verge of having a panic attack... lol)

Super-weird error with builds on latest Windows runner (Github)

2024-05-18 Thread drkameleon
We've been seeing an issue lately (= last 5 days) that apparently has nothing do with any change. It's practically the exact same code, only after the upgrade of GitHub's runners (Windows `20240421.1.0` to `20240514.3.0`), it keep crashing consistently with the exame same error message. I even

Super-weird error with builds on latest Windows runner (Github)

2024-05-18 Thread drkameleon
If the question is about Nim, we've been using the latest one (2.0.4) all the way through - tried with `2.0.2` but no difference at all. If the question is about GCC, that's the second change I've noticed: `mingw-w64-x86_64-gcc-13.2.0-6` (the old one) vs `mingw-w64-x86_64-gcc-14.1.0-3` (the new

Super-weird error with builds on latest Windows runner (Github)

2024-05-18 Thread drkameleon
I think you are spot on! Thanks _a lot_ for the pointer!! Now, let's see how we do it so that it uses the this particular branch! Thanks again, seriously! :)

Weird bug(?) with JS backend

2024-01-21 Thread drkameleon
Whoa! Thanks a lot for the detailed explanation! :)

Atlas shrugged...

2024-01-20 Thread drkameleon
Since apparently nobody mentioned it(?!), a +1 from me for the Rand reference in the title of the post (which I myself had missed earlier). P.S. And... good job in general, of course! :)

Weird bug(?) with JS backend

2024-01-19 Thread drkameleon
That's exactly what I imagined initially (that it was a hack to access the pointer), but it appears as if it's the only case where this happens. I've checked different functions taking a Value as a param, and it's normally accessed directly (in terms of generated code). So, I'm wondering what it

Weird bug(?) with JS backend

2024-01-19 Thread drkameleon
I've been fixing issues related to our Web builds and I came across something strange (in terms of the code generated). We have this call to `hash`: `root` is a Value (which is a `ref obje

Getting std/rationals to work for the JS backend

2024-01-17 Thread drkameleon
To avoid creating any confusion (in case sb comes across this question): the issue mostly had to do with me using std/rationals through Macros - when used normally, it should work fine (even for the JS backend!)

Getting std/rationals to work for the JS backend

2024-01-17 Thread drkameleon
Whenever I try to compile to `js`, the fact that the project makes (some limited) use of std/rationals brings the whole thing to a halt. Basically, this line: ai = int(x) Run .../rationals.nim(103, 16) Error: illegal conversion from 'float' to 'int'

A custom '=destroy' hook which takes a 'var T' parameter is deprecated

2024-01-12 Thread drkameleon
Somewhere in our internal GMP wrapper, we keep getting this warning: Warning: A custom '=destroy' hook which takes a 'var T' parameter is deprecated; it should take a 'T' parameter [Deprecated] Run The code triggering it:

Template being called twice with Nim 2.0

2023-08-09 Thread drkameleon
@Zerbina I did as you suggested (move the... `move` inside the template). It appears to be working beautifully: Very nice one. Thanks again! ;-)

Template being called twice with Nim 2.0

2023-08-09 Thread drkameleon
> Apart from working around the compiler bug, this also removes the need to use > move at pop callsites. That's _precisely_ what I was thinking about right now, after having isolated the issue that is. Thanks a lot for your input! Really appreciated! :)

Template being called twice with Nim 2.0

2023-08-09 Thread drkameleon
So, basically the question can be simplified to this... How do I make this work? template pop*(): var Value = SP -= 1 Stack[SP] # some other template let x {.inject.} = move stack.pop() Run It currently produces: //let

Template being called twice with Nim 2.0

2023-08-09 Thread drkameleon
Looking into the `move` implementation (and given that my `pop` is a _template_ ), I think the reason why this happens is quite obvious:

Template being called twice with Nim 2.0

2023-08-09 Thread drkameleon
OK, we've made some progress... If I remove this `move` from here: Then the whole thing magically works. But then, I get a _copy_ (`eqcopy___`), instead of a _move_ (`eqwasMoved___`). Ideas?

Template being called twice with Nim 2.0

2023-08-09 Thread drkameleon
Interesting idea. An example of a value passed as `spec` would be this: (the `args` value). Do you think there could be something wrong with that?

Template being called twice with Nim 2.0

2023-08-09 Thread drkameleon
I've been having issues with compiling Arturo with the latest Nim version and finally I managed to at least spot one piece of code that behaves weirdly. The piece of code in question (along with different debugging `echo` statements) is this:

Checking for exact floating-point representations

2023-05-01 Thread drkameleon
Thanks for the suggestion! I just tried one of the proposed solution, since it seemed rather straightforward: func oddPart(x: int): float = result = frexp(float(x))[0] while result mod 1.0 != 0.0: result *= 2.0 func canBeCoerced(x: VRati

Checking for exact floating-point representations

2023-05-01 Thread drkameleon
Re-thinking about it: perhaps I'm wrong and 5401/1800 _is_ actually identical to 3.0005556?

Checking for exact floating-point representations

2023-05-01 Thread drkameleon
The question is not extremely Nim-specific, although it could be more than I can think of... So... I'm trying to figure out whether a number, represented as a rational (with a numerator and a denominator, both 64-bit integers) can be accuretely represented as a floating-point number. My code:

Using named blocks with break instead of exceptions for targetted exception handling

2023-04-28 Thread drkameleon
> The key idea here is that you collect the error and only check once at the > end... I've contemplated the idea although I didn't try it in practice. Definitely makes sense... I'll try it! Thanks for the suggestion! :)

Using named blocks with break instead of exceptions for targetted exception handling

2023-04-28 Thread drkameleon
Awesome! Thanks for the feedback! I've been rewriting Arturo's internal Rational numbers module (basically, I want it to support both "normal", 64-bit int/based Rational numbers and GMP BigNum-based Rational numbers, pretty much like all numbers in Arturo), so I got totally caught up in this (a

Using named blocks with break instead of exceptions for targetted exception handling

2023-04-28 Thread drkameleon
I've been experimenting with the idea and I'm sharing it so that you can tell me what you think. Basically, let's say I have a block with some of the operations possibly throwing an overflow - or to be more precise one of the compiler intrinsics (e.g. `__builtin_sadd_overflow` return true). So

Checking whether we are in .compileTime

2023-04-26 Thread drkameleon
Jesus christ! I guess I'm blind... I kept looking and looking, and experimenting; couldn't find it! Thanks!!!

Checking whether we are in .compileTime

2023-04-26 Thread drkameleon
I'm trying to use a specific module that I have written both from normal code and from compile-time code (via macros). Some aspects of the module in question make use of external C library and thus they cannot be used at compile-time, so I'm thinking of `when`-disabling the parts that are not m

Nim v2.0.0 RC2 is out

2023-04-05 Thread drkameleon
Is there something wrong with `sqlite3` and this release? I tried to compile with this last version and seemingly it's complain about the module not being found: Error: cannot open file: sqlite3 Run

Help with macro/template-style transformation

2023-02-21 Thread drkameleon
I've made some progress by explicitly declaring the types of the macro arguments, like `static[string]` and `static[set[ValueKind]]` respectively. Now, I'm struggling with unrolling-the-loop, but I think I'll somehow manage to solve it:

Help with macro/template-style transformation

2023-02-21 Thread drkameleon
The understand the context a bit (the "array" in question is `attrs`): The above example was obviously over-simplified, on purpose.

Help with macro/template-style transformation

2023-02-21 Thread drkameleon
One of my many different attempts: static: for v in attrs: echo "\t" & $(v[0]) & "=>" & $(v[1]) # this works fine let att {.compileTime.} = $(v[0]) # broken let tp {.compileTime.} = v[1][0] attrTypes(att

Help with macro/template-style transformation

2023-02-21 Thread drkameleon
I have a completely-static array like this: [ ("name1", {ValueType1, ValueType2}), ("name2",{ValueType3, ValueType1}), ... ] Run I want to transform the above, at compile-time, to this: let tName1 = {ValueType1, Value

Cross-compiling for M1 mac from non-M1 mac

2023-01-30 Thread drkameleon
Thanks a lot for the very to-the-point answers!!! :)

Cross-compiling for M1 mac from non-M1 mac

2023-01-28 Thread drkameleon
So, that's the case. Basically, the main use scenario is having a Github workflow compile binaries for the M1. (I'm mainly using a Mac, and as a matter of fact I also have an M1-powered one around, but I would totally love it if I was able to automate the whole process. And given that GitHub's

"cannot prove that it's safe to initialize"

2023-01-16 Thread drkameleon
OK, so I found a way to make it work... Instead of declaring `callType` as DiscriminatorKind like: var callType: DiscriminatorKind Run I declare it with a range of possible/allowed DiscriminatorKind values: var callType: lowerAllowedDiscriminator..highest

"cannot prove that it's safe to initialize"

2023-01-16 Thread drkameleon
I'm trying to create a new object with a variable discriminator and a specific field that corresponds to this discriminator. And although I can see why the compiler cannot "prove" that it's "safe to initialize", I can assure you it is. The question is, how would I get around this error? This i

Get time at compile-time

2022-12-07 Thread drkameleon
Awesomeness!!! Thanks a lot! :)

Get time at compile-time

2022-12-07 Thread drkameleon
As I can see, this is more than a little issue: In my case, I don't even need the whole time - just the date. Let's see...

Get time at compile-time

2022-12-07 Thread drkameleon
Silly question - and not such an important one - but I thought I was doing right only to realize I wasn't. So, how can I do something equivalent to the following? let buildTime = static now() Run This leads to: Error: cannot 'importc' variable at compile

Parsing Unicode and lexbase

2022-12-01 Thread drkameleon
Makes sense, that's along the lines of what I was thinking... Thanks for the input! :)

Parsing Unicode and lexbase

2022-12-01 Thread drkameleon
I now - as I was typing the question as a matter of fact - noticed this: and its corresponding: So, I guess the answer is I'm already doing it pretty much like it shou

Parsing Unicode and lexbase

2022-12-01 Thread drkameleon
**Question/food-for-thought:** What would be the most sensible way to go about support unicode values in a lexer using `lexbase` / BaseLexer as its basis? I mean, as far as I can tell, using `BaseLexer` we can actually load up our string/input into a buffer and move through it byte-by-byte:

Not able to get `in` for sets to work properly

2022-11-29 Thread drkameleon
Hahahaha @ LaTeX (I can't believe you remember that!)

Not able to get `in` for sets to work properly

2022-11-29 Thread drkameleon
Observation (I spotted it!) If I change this: if unlikely(not (x.kind in static spec[0][1])): Run to this (basically, just remove `static`): if unlikely(not (x.kind in spec[0][1])): Run then it compiles to: T9_ = NIM_UNLIKELY(

Not able to get `in` for sets to work properly

2022-11-29 Thread drkameleon
I imagined that. But I'd still like to benchmark the two version to see if there is any actual difference. At some point (I honestly don't remember how; it was after moving the different parts around and trying to pass just an one-dimensional array to `require`, I think), I got it to work... bu

Not able to get `in` for sets to work properly

2022-11-29 Thread drkameleon
My main doubt is why this is not properly converted into a set-membership test...

Not able to get `in` for sets to work properly

2022-11-29 Thread drkameleon
Well, the so-many uses of static are to be cleaned up. That's exactly what I'm working on right now. Having said this, the test `x.kind in spec[0][0]` for example cannot be static in its entirety since `x.kind` is not known at compile-time. `spec[0][0]` is, however.

Not able to get `in` for sets to work properly

2022-11-29 Thread drkameleon
I have an enum `ValueKind` and set based on this: `ValueSpec = set[ValueKind]` Most of the times I use something like `someValue in someSpec`, the test works correctly and transformed into bit arithmetic (in the C code). I have one particular case I've been struggling with, which I cannot get to

Using templates with generic or untyped parameters

2022-11-18 Thread drkameleon
Very interesting as well! :)

Using templates with generic or untyped parameters

2022-11-17 Thread drkameleon
That definitely looks like a promising approach, at least until I figure out how to clean up the core idea... Thanks a lot for the input!

Using templates with generic or untyped parameters

2022-11-17 Thread drkameleon
It's `iterateThrough`, which as you may see below gets called different times.

Using templates with generic or untyped parameters

2022-11-17 Thread drkameleon
The truth is it's very difficult to show what I mean exactly since the actual code is fairly complicated (right now, I don't even _I_ know what I'm doing...) But let's say the starting point is: (now imagine,

Using templates with generic or untyped parameters

2022-11-17 Thread drkameleon
I totally get what you mean... The problem is that if there are 3-4 "switches" like myBool, I would end up writing a vast if-else tree just to call `doSth` with different (compile-time) known params. And, yes, I'm not expecting the final binary would be different; it would still lead to an eno

Using templates with generic or untyped parameters

2022-11-17 Thread drkameleon
type IntOrString = int | string template doSth*(x: IntOrString): untyped = when x is int: echo $(x + 1) else: echo $(x & "1") when isMainModule: doSth(2)# prints 3 doSth("X") # prints X1

Overriding default C/C++ options + error with 1.6.8 / C++ / macOS

2022-11-07 Thread drkameleon
The issue seems to be fixed after converting `-x objective-c` to `-x objective-c++` for Mac builds. I'll update you on the issue! :)

linearScanEnd caveats?

2022-11-07 Thread drkameleon
I've been experimenting with `linearScanEnd` and I know how it works and what C code it produces. The question is: is there any particular case where the pragma is ignored? I've just attempted to use it in a while loop, with the case statement inside and it seems as if it's complete ignored. A

Nim 1.6.10 release candidate

2022-11-04 Thread drkameleon
That's awesome!! Thanks! :)

Nim 1.6.10 release candidate

2022-11-03 Thread drkameleon
Any changes related to: ? (I've practically been stuck to 1.6.6 until this gets fixed somehow...)

Change ref object variant in-place - drawbacks?

2022-10-26 Thread drkameleon
Let's say I have this type of _ref object_ : type ValueKind = enum Integer String Block Value = ref object case kind: ValueKind: of Integer: i: int of String:

Declaring an uninitialized seq & avoid unnecessary zero-mem's

2022-10-24 Thread drkameleon
Thanks a lot for the answer and the explanation! Extremely helpful and thorough as usual! :)

Declaring an uninitialized seq & avoid unnecessary zero-mem's

2022-10-24 Thread drkameleon
My problem with this is: > Only available for numbers types. So, I'm wondering what the safest solution would be in my case...

Declaring an uninitialized seq & avoid unnecessary zero-mem's

2022-10-24 Thread drkameleon
Let's say I want to declare a seq of ref objects (which I'm about to fill in the next few lines of code - so, we _know_ the array will be filled). However, if I do it like this, the array is unnecessarily initialized and zeroMem/memset: var myArr: seq[someRefObject] # doSth

Enums, custom overloads & redundant strings

2022-10-21 Thread drkameleon
Answering my own case, in the example above to avoid the default strings for the enum, all I did (and it did work) was to directly assign the string values (inside the _enum_ definition) and avoid the `$` overload altogether. Quite an obvious solution, I guess... :)

Enums, custom overloads & redundant strings

2022-10-21 Thread drkameleon
Jesus christ! I forgot to make the `$` overload public... How stupid! (I re-organized the code/modules a bit and that's the side effect :S) (I have had such issues in the past and I thought it was something else; in this case, it was just me. Jesus!)

Enums, custom overloads & redundant strings

2022-10-21 Thread drkameleon
I'll show you the example in question... Here we have the **printable** module, which comes with a `$` overload which is supposed to take Value objects and return them stringified. As you can see there are different _kinds_ of Value objects, so the stringification process varies accordingly. L

Enums, custom overloads & redundant strings

2022-10-21 Thread drkameleon
My main case is an `enum` value inside an `object`. Both the object and the enum have `$` overloads. Generally, it works as I expect it to. Until it doesn't... (as for `bind`, I've never ever used it; I'm not sure I fully understand your point...)

Enums, custom overloads & redundant strings

2022-10-21 Thread drkameleon
I have defined an enum type like: type myEnum = enum someValue = "str-Value" anotherValue = "another-Value" Run with a `$` overload like: func `$`*(v: myEnum): string = case v: of someValue: return "one"

From too many copies to too few

2022-10-14 Thread drkameleon
No, it's not unique nor hard. Personally, I'm all for pointers. The problem is I find some inconsistencies (mostly stemming from a combination of the GC + the `seq` values), or things working too automagically - for me - that it's not always that clear what is going on behind the scenes...

From too many copies to too few

2022-10-14 Thread drkameleon
Minimal example: type ObjKind = enum A B C Obj = ref object case kind:ObjKind: of A: s: string of B: i: int of C: a: seq[Obj] let VEMPTYARR = Obj(kind: C,

Packing integers and GMP bignums in a single value

2022-10-11 Thread drkameleon
So, I've already said () I've been experimenting with some like NaN-boxing. This time the question is about something similar, but simpler. Let's say we could have simple 64-bit int values that could hold infinitely-large integers: * if the number is <= 0x7

Nim 1.6.8 released!

2022-10-07 Thread drkameleon
Can you please have a look here?

Selecting/installing older nim package on FreeBSD

2022-10-07 Thread drkameleon
Since the issues with Nim 1.6.8 (), I have been forced to stick to 1.6.6 - until further notice, that is. However, since I have CI actions using the default (1.6.8) package, now I'm struggling with moving back to 1.6.6. Especially with FreeBSD. My current work

Copies, seqs, assignments & templates

2022-10-07 Thread drkameleon
Thanks a lot for the input, all of you! The problem with @planetis's approach is this `lent`, as @demotomohiro also mentioned. I have managed to resolve the issue with a rather weird approach, but it definitely does what I want it to: macro ensureCleaned*(name: untyped): untyped =

Copies, seqs, assignments & templates

2022-10-03 Thread drkameleon
Ultra-minimal example that highlights the issues with using `if` .. `else` as a pseudo-ternary operator: type SomeObj = ref object s: string when isMainModule: var ob = SomeObj(s:"Hello world") var a = 2 echo (if a == 2: ob.s else:

Copies, seqs, assignments & templates

2022-10-03 Thread drkameleon
All that being said, I've started thinking if - perhaps - the solution would be for me to implement a proper ternary operator... lol

Copies, seqs, assignments & templates

2022-10-03 Thread drkameleon
The truth is I haven't looked into it, nor do I know how they work exactly. I cannot find anything in the documentation. Thanks for the suggestion in any case! :)

Copies, seqs, assignments & templates

2022-10-03 Thread drkameleon
I get your point, totally. The problem is that this `op` part, may be more than just... one proc call. > btw why exactly butFirstPreprocess makes a copy? I don't get it. I wish I did. Basically, let's take this (actual code shown): push newInteger((if x.cleaned: x.a else: cleanedB

Copies, seqs, assignments & templates

2022-10-03 Thread drkameleon
I feel as if I'm posting something along the exact same lines, for the 1000th time, but I guess it's because I still cannot make it work as I want to. So... the question is - theoretically - very simple. We have this piece of code: doSomethingWith(x) Run Now this `x`

Getting pointer to a seq

2022-09-30 Thread drkameleon
Thanks a lot for the input! I think your answer indirectly gave me an idea: template cleanArrayTmpl*(arr: Value): untyped = if arr.cleaned: addr arr.va else: ret = arr.va.filter((x) => x.kind != NewlineV) addr ret var ret:

Getting pointer to a seq

2022-09-30 Thread drkameleon
I've been experimenting with anything practically, so I'm here to ask... **Minimal example following:** import sequtils, sugar type ValueKind* = enum StringV ArrayV NewlineV Value {.acyclic.} = object case k

See generated code after template processing?

2022-09-29 Thread drkameleon
Thanks a lot! For some weird reason, I have never managed to use `--expandMacro` \- basically, I don't know what it's supposed to do, or - more precisely - where the expansion is to be shown... As I cannot simply spot it anywhere... :S

See generated code after template processing?

2022-09-29 Thread drkameleon
So, since - for better or for worse - I'm making some heavy use of templates and trying to reduce them & debug a few things here and there, I'm wondering how I could have a look into the final/generated Nim code after the templates have been processed. (Perhaps, I'm missing something here and t

Overriding default C/C++ options + error with 1.6.8 / C++ / macOS

2022-09-28 Thread drkameleon
t;-std=c++11").} {.passC: "-DWEBVIEW_COCOA=1".} {.passL: "-lstdc++ -framework WebKit".} Run When compiling with Nim 1.6.6, the actual command is: clang -c -w -ferror-limit=3 -DNDEBUG -fvisibility=hidden -I"/Users/drkameleon/Docum

Overriding default C/C++ options + error with 1.6.8 / C++ / macOS

2022-09-28 Thread drkameleon
I think I will agree... I believe the culprit is this PR you mentioned: The problem is... the project is written purely in Nim + C (and Arturo), with literally _one_ `.cc` file, which - as I said previously - I struggled to get it to compile (without

Overriding default C/C++ options + error with 1.6.8 / C++ / macOS

2022-09-27 Thread drkameleon
clang++ -c -std=gnu++14 -funsigned-char -w -ferror-limit=3 -DNDEBUG -fvisibility=hidden -I"/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras/mimalloc/include" -I/Users/drkameleon/Documents/Code/OpenSource/arturo-lang/arturo/src/extras -DWEBVIEW_COCOA=1 -O

Battling with copies & a silly question

2022-09-26 Thread drkameleon
Thanks for this `addr table[key]`. I guess I needed some confirmation to make 100% sure I won't mess with the GC. Awesome :)

Battling with copies & a silly question

2022-09-26 Thread drkameleon
OK, so, first of all let me tell you that I have spent countless hours analyzing what the Nim compiler is doing and how Nim code gets converted to C. Let's take this naive example: * we have a table (string keys, some user ref object values) * I'm looking up a key, get the value back * The

update dictionary value function?

2022-09-24 Thread drkameleon
I think @Yardanico's answer nailed it. I'll try it out, but - judging from its implementation - I think that's exactly what I've been looking for. My problem with @asteroid_den's approach is that there are 2 lookups (one for `k in t` and another one for `t[key]=`). And that's exactly what I'm tr

update dictionary value function?

2022-09-24 Thread drkameleon
Basically, I'm in the process of writing a more-specific hash table implementation, based on the existing one, but more tailored to my needs and with some functions that I consider "missing". I'm not sure whether I'll end up using it in the end, but I'm still trying different things out. One o

how can I buy "Mastering Nim" without using amazon services?

2022-09-23 Thread drkameleon
Then, good for me that I have never published anything math-related! (nor do I have any similar plans) lol Seriously now, professional typesetting is more than that. The point is how would sb go the InDesign/QuarkXpress way, but with all the automation that a programmer can benefit from. (and,

how can I buy "Mastering Nim" without using amazon services?

2022-09-23 Thread drkameleon
I'm the first person to totally underline how ugly this whole thing is. And the learning curve is even uglier. All I'm saying is that, if you put A LOT of effort into it, and are willing to generate it via your own scripts (what I call "automation"), then the result can easily beat every amateu

how can I buy "Mastering Nim" without using amazon services?

2022-09-23 Thread drkameleon
For me, since publishing _is_ my main business, I would suggest Amazon for both paperbacks + ebooks (kindle, etc). Less profit margin, far better exposure (and ease). For flexibility, any MoR (Merchant of Record) type of service. I've personally used Paddle () for the p

High-to-low range in slice

2022-09-22 Thread drkameleon
OK, I know the question is nothing so important per se, but I'm asking for the sake of it. Let's say I have an array/seq and some slice: arr[x .. y] Run Apparently, this works only if x <= y. What if x > y? Is there any way to do it, using something along the same li

compile-time avoid Exception statement

2022-09-22 Thread drkameleon
Spot on! Thanks a lot! For some reason, I took it for granted that `raise` expected a param, but - apparently - it doesn't. Thanks again! :)

compile-time avoid Exception statement

2022-09-21 Thread drkameleon
In a proc, with static variables, I have somewhere: except SomeError as e: when not staticVarOn: raise e else: discard Run This obviously leads to 2 different versions of the _proc_ : one (when staticVarOn is true) re-raising SomeEr

  1   2   3   >