newSeq() named inconsistently?

2022-03-18 Thread Araq
It's not unthinkable but I'm not a fan of the idea either.

Case (switch) statement and modulo

2022-03-18 Thread chikegar
Hi, I'm learning nim and decided to translate some FizzBuzz code from Basic that uses Case(switch) vs If Else If. Here's the Basic syntax: i = 1 to 100 select case case i mod 15 = 0 print "FizzBuzz" case i mod 3 = 0 pr

How to prevent nim generate C code access parent type through `Sup` field?

2022-03-18 Thread Dabod
Thank you. I was trying to see if `{.importc, inheritable, pure.}` can directly map the class hierarchy of gobject to nim, it will look simple and natural. Now I am trying to use concept + template write binding

How to prevent nim generate C code access parent type through `Sup` field?

2022-03-18 Thread Dabod
I am playing with gobject/gtk.

Strenc+Parseopt=AssertionDefect

2022-03-18 Thread jsc13
Thanks, @ElegantBeef! I was able to fix my issue. I used a while instead of a for and that seemed to work.

Simple linked list questions: Correct proc signature for first()

2022-03-18 Thread DMisener
Araq>Shouldn't this be ... Proc first[T](list: SomeLinkedList[T]): SomeLinkedNode[T] = result = list.head Run Probaby... but I really didn't want the now extraneous _next_ from the _source_. My implementation is less than ideal since it always allocates a new no

Simple linked list questions: Correct proc signature for first()

2022-03-18 Thread shirleyquirk
I disagree that linked lists are obsolete; they are fundamental to the history of computer science, are still widely used (e.g. the linux kernel is full of them), and are still useful in some niches (e.g. mutating a container while iterating over it) car/cdr however, were assembly instructions

newSeq() named inconsistently?

2022-03-18 Thread markus_gritsch
Thanks for the quick reply and clarification. I know, changing such fundamental things is not possible because of existing code, and being so used to it probably make it seem a non-issue. OTOH, having inconsistencies in fundamental places confuse new users which are trying to learn Nim and "get

newSeq() named inconsistently?

2022-03-18 Thread Araq
You're correct, `newSeq` should have been `initSeq` according to our own rules but `newSeq` predates the rules.

newSeq() named inconsistently?

2022-03-18 Thread markus_gritsch
Hi, I just started learning Nim and already like it a lot. Having read about `ref` types and the proc [naming convention](https://nim-lang.org/docs/nep1.html), I wonder if `newSeq()` is named inconistently, maybe because of historic reasons, or if I misunderstand something: import

Simple linked list questions: Correct proc signature for first()

2022-03-18 Thread Araq
Shouldn't this be instead: proc first[T](list: SomeLinkedList[T]): SomeLinkedNode[T] = result = list.head Run But I don't understand the point of it anyway. Linked lists are a mostly obsolete data structure and not particularly convenient to work with either.

The 'for i in ...' loop inside parsing macro

2022-03-18 Thread ynfle
You don't need to quote anything with a ` in a template