Re: examples or documentation of Source Code filters

2020-03-21 Thread kaushalmodi
It can be used to generate any templated file you like. I have used it to 
generate SystemVerilog and HTML files.

What are you trying to achieve and where do you need help with the Source Code 
Filters? 


examples or documentation of Source Code filters

2020-03-21 Thread lotzz
Hi, sorry I am looking into the source code filters for nim and it is actually 
kind of hard to figure out what a good use case for them is, or if they have 
any uses besides just generating xml. I was just wondering if anyone had any 
examples of how they have used them in their projects or anywhere to find more 
information on them in action so I can see what I can do with them. it would be 
greatly appreciated. **Thanks**


Re: Brainfuck interpreter bug

2020-03-21 Thread jyapayne
A hint as to why it crashes is 
[here](https://github.com/brain-lang/brainfuck/blob/master/brainfuck.md#increment-).

You're using an `int`, when you should be using a `uint8` for your 
`dataPointer` variable.

Also, [this python 
example](https://github.com/pocmo/Python-Brainfuck/blob/master/brainfuck.py) 
can help you precompute a jump table so you don't have to iterate over every 
instruction every time.

If you are still stuck and want the answer (plus some helpful comments), [here 
is a working example from your 
code](https://gist.github.com/jyapayne/ab2a0745382481bcdb86977ca7149e11)


Brainfuck interpreter bug

2020-03-21 Thread drguildo
I'm trying to learn a bit about Nim and so decided to write a Brainfuck 
interpreter as a learning exercise. The trouble is there's a bug that causes my 
interpreter to crash on the "Hello World!" example from Wikipedia:

`[>[>++>+++>+++>+-]>+>+>->>+[<]<-]>>.>---.+++..+++.>>.<-.<.+++.--..>>+.>++.`

I've been trying to fix it for days but I'm completely stumped as to what's 
causing it and was hoping somebody smarter than me could maybe figure it out. 
Here's a link to my code:

[https://gist.github.com/drguildo/212d14b724e85c833efd6e524290276d](https://gist.github.com/drguildo/212d14b724e85c833efd6e524290276d)


Re: Nimble raiseOSError: cannot install a package

2020-03-21 Thread JazzPlayer
AFAIK no.


Re: Nimble raiseOSError: cannot install a package

2020-03-21 Thread shashlick
Is it an alias? 


Re: Nimble raiseOSError: cannot install a package

2020-03-21 Thread JazzPlayer
In fact it is. But whenever I type _where git_ my prompt says it could not 
locate the file, but I can use type _git_ normally. Very strange.


Re: Forward declaration of object name

2020-03-21 Thread doofenstein
incomplete forward definitions in C are almost exclusively used either to hide 
internal structures or for recursive types. The former is done with 
exported/unexported fields, the latter just works in Nim, as long as the types 
are declared in the same type section, so there's no need for them in Nim.


Gtk apps in Nim

2020-03-21 Thread zulu
Are there any bigger apps in Nim with Gtk ?

Cc @Stefan_Salewski


Re: Nimble raiseOSError: cannot install a package

2020-03-21 Thread dom96
It's looking like Nimble cannot find git for some reason, are you sure it's in 
the PATH of the terminal you're running it from?


Re: Nimble raiseOSError: cannot install a package

2020-03-21 Thread JazzPlayer
Do you mean operating system? I'm using Windows 10.


Looking for feedback for my code

2020-03-21 Thread Pixeye
I wanted to write a simple observer to get callbacks when some of the variables 
of an object change. It's useful when working with UI for example and this 
pattern serves me well in my current 
<[http://www.uwd.pixeye.games/>game](http://www.uwd.pixeye.games/>game) project 
`( I'm writing game on C# + Unity though )`

The code itself can be found on 
<[https://gist.github.com/PixeyeHQ/fbec35b25b667b847b4eac413a8539a5>github](https://gist.github.com/PixeyeHQ/fbec35b25b667b847b4eac413a8539a5>github)
 gist

It works : ) BUT

  1. I'd like to know if there any more performant / better / idiomatic way to 
write this in Nim.
  2. In C# I had to write tons of custom IEqualityComparer to allow my 
observer to work with custom types. Do a programmer need to provide any sort of 
this stuff in Nim?



>From what I've seen Nim easily compares tuples variables and anything I drop 
>on him. In comparing with C# it's insane how less code I wrote in Nim


sealed class EqualityVector2 : IEqualityComparer
{

internal static EqualityVector2 Default = new 
EqualityVector2();

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(Vector2 self, Vector2 vector)
{
return self.x.Equals(vector.x) && 
self.y.Equals(vector.y);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetHashCode(Vector2 obj)
{
return obj.x.GetHashCode() ^ 
obj.y.GetHashCode() << 2;
}

}


Run

Thanks in advance!


Re: Nim mention in arstechnica

2020-03-21 Thread hernytan
Love how they mentioned the cross compilation features but didn't go into 
detail.. it would probably be a lot longer if they mentioned it, haha


help information sécurité

2020-03-21 Thread JPLRouge
Hello : or is in terms of Nim-Lang security compared to other languages. we 
hear a lot about Rust, but I think it's mostly a way of programming that 
influences security outside of traditional reasons ...

This is a question for information


Re: Forward declaration of object name

2020-03-21 Thread leorize
That's not possible in Nim, instead just import the second file to get the 
object definition.


Re: Nimble raiseOSError: cannot install a package

2020-03-21 Thread geotre
What platform are you installing on?


Forward declaration of object name

2020-03-21 Thread Lachu
I need to forward declare of object name. I use c2nim and it generates code 
similar to below:


   #First file
   connection {.bycopy.} = object
   #New line
   #Second file
connection* {.bycopy.} = object
  id*: cint
  sock*: cint


Run


SIGSEGV: Illegal storage access.

2020-03-21 Thread mantielero
This is the second time I face this error:


SIGSEGV: Illegal storage access. (Attempt to read from nil?)

So I am pretty sure this is something that I systematically do wrong. This 
happens when I wrap some libraries.

My question is what is the right strategy to debug this sort of problem 
(bearing in mind I have never used gdb). Any particular recommended read?


Re: Handling case in getSectionValue in parsecfg

2020-03-21 Thread pietroppeter
For the first issue, you could -after parsing the ini file - turn all section 
keys and parameter keys in lower case.