(heavily off topic, just matter of personale taste)
I suspected this would have been the proposed solution
I started to appreciate exceptions in my Java past, and I still use them in C++
even though my peers seem not to appreciate much having to enclose the opening
of a file in a try block.. I
I like them, they make the code even shorter and that's what "lambdas" are all
about. I don't really need the "flexibility" of using `a`, `b`, `x`, `y`, `z`
here instead but I suppose the ability to nest these suffers.
_(slightly off topic by not addressing directly the case statement, but I think
this is the heart of the issue)_
If there was an "Invalid" role, which is the "else" case,
type
Roles = enum
invalid,user,catering,manager,sysadmin
then the consumer of this co
Like sortIt() or applyIt() where we are forced to use the it variable name in
the condition?
When I started with Nim some years ago I thought that that is the only possible
way to do it in Nim -- but I always regard it as very ugly.
I just remembered that I tried successfully to use a custom va
while this code compiles fine
from strutils import `%`
type
Roles = enum
user,catering,manager,sysadmin
converter toRole(s : string): Roles =
case s
of "user":
return Roles.user
of "catering":
I had a similar problem in the past and I have considered a similar solution.
However, I ended up using one custom fixed size hash table with open
addressing. Idea is that table once filled up, start throwing away one element
everytime another one needs to be inserted. Table doesn't ever grow. I
Hi, I am actively using Nim's side effect tracking system and marking procs
with noSideEffect pretty much everywhere. I have external requirement not to
have side effects and Nim helps here quite a bit.
However, I have place in a code that logically I don't have side effects, but
physically I a
In the past 2 days I've been researching various ways to avoid expensive
allocations/deallocations in tight loops on GPU, by reusing memory.
Apparently this is also a recurrent issue in game programming so I'd like to
share my approach and request for comments.
My use-case:
* I allocate
dataRef to have the deallocation of the data managed by Nim GC.
data for normal use through foo[10] (thanks to UncheckedArray). Yes data is
public because in my use case this is only used internally, and getter/setter
would just add boilerplate for no gain. Same thing for len.
Regarding copy, j
@jxy Well, I wanted to make a call optimization library, actually. Including
various recursion optimizations (I know there is memo but it provides only one
opt method and even my pull request to it was never accepted). Inlining is, of
course, one of the possible optimizations (so I guess it's a
@mtrasim I've already said it's a bad idea (even on many architectures on which
it's possible). And even if you don't really have a heap, it doesn't mean you
couldn't use dynamic memory if a language supports custom allocators. You can
provide a memory pool on a stack, that's what I actually di
Mine version would not. The old code can't use parameters non-existing then so
you'll just have to add another split argument which works like splitWhitespace
does today and then make splitWhitespace an alias for some split call (with
depreciation annotation) for backwards compatibility.
this is another generics typerel bug that should be reported.
13 matches
Mail list logo