Re: Compile Time Evaluation of Constants From C-Header Files

2017-08-29 Thread ivanitto
Thanks Andreas. Would you consider such a minor change in stdlib as desirable?

Re: Compile Time Evaluation of Constants From C-Header Files

2017-08-29 Thread ivanitto
Thank you @jlp765, I know about the static, but asking about a different thing: Is there a way in nim language to use values of S_IFREG and S_IFDIR in the 'of' clause of the 'case-of' statement? (for example, like in the post above)

Compile Time Evaluation of Constants From C-Header Files

2017-08-28 Thread ivanitto
Is there a way to make nim compiler to evaluate constants from C-header files at compile time? For example, symbols S_IFREG and S_IFDIR (from posix.nim <\- sys/stat.h) used in following code snippet: case x: of S_IFREG: echo "file" of S_IFDIR: echo "dir" else:

Re: How To - Proper Interfacing In Nim

2017-06-30 Thread ivanitto
Goran, thank you very much! Your code perfectly fits with what I needed and comments immediately answers all the questions running in head. Btw, I was pleased to read your article "Nim and OO" some time ago and discover another Smalltalk fan. I myself fell in love with Smalltalk from the first s

Re: How To - Proper Interfacing In Nim

2017-06-30 Thread ivanitto
The question is not about interfacing with other languages, but exceptionally about interfacing of Nim modules with each other. The C language allows to hide internals of a type declaration but still have type checking using just "half-anonymous" `struct BoxOfStuff *` pointer. I want this functi

How To - Proper Interfacing In Nim

2017-06-10 Thread ivanitto
Does Nim support C-language feature to declare a reference to an object without including the external header file where the object is defined? * * * For example, what would be Nim analogue for the following C code: typedef struct BoxOfStuff * pBox; /* no need to incl

Re: Nim - Unique Module Names

2017-05-05 Thread ivanitto
Thank you for the explanation. Yes, I'm really with you on the idea of enforcing the coding style. I'm not fully sure yet, but looks like I'm having a case where it would be better (for the sake of simpler/clearer software design) to distinguish symbols basing on the filesystem path.

Nim - Unique Module Names

2017-05-03 Thread ivanitto
Why there is a restriction "module names need to be unique per Nimble package" ? Is this restriction of the Nim language or just a temporary inability of the C-backed ?

How To Share a Nim Module Functionality

2017-01-11 Thread ivanitto
I have a question about following Nim compiler/language use case: suppose, I created a library and want to share it's functionality with others. But, I do not want to share the source code, but just a binary distribution plus an interface. This use case can be solved by creating a C-header file

Re: Check For A Symbol

2016-09-14 Thread ivanitto
Thank you guys, it helped.

Check For A Symbol

2016-09-13 Thread ivanitto
Is it possible at compile time/run time to check if symbol "" is defined? If it is defined, then is it possible to get know if it is Proc/Variable/etc ?

Re: Convert seq into tuple

2016-07-28 Thread ivanitto
Thanks Flyx, your solution solves the task, but still unlikely able to generate (target) tuple of arbitrary size: for example, how would you write code to convert seq/array which consists out of 100 (or 1000 or 10M elements) ? You would have to write something like: var myTuple: t

Convert seq into tuple

2016-07-27 Thread ivanitto
Is there a native/elegant way to convert seq into tuple? For example, I'd like to instantiate some variables basing on values stored in a seq like this: var s: seq[int] = @[1,2,3] var (a,b,c) = s Possible solution would look like this (or even more elegant?):