Re: Connection-Pooling Compile-Time ORM

2020-07-02 Thread Varriount
While this is a neat use of templates to create an SQL DSL, where does the ORM part come in? I don't see any place to automatically load values into an object/ref, aside from the procedures returning sequences.

Re: Norm 2.0.0

2020-06-24 Thread Varriount
I don't quite understand this:

Re: Module queues is not working? Is it deprecated?

2020-03-03 Thread Varriount
What problems are you having? Can you post code that demonstrates your problems?

Re: reader macro

2020-02-19 Thread Varriount
Do you mean something like [NPeg](https://github.com/zevv/npeg)?

Re: closure function types are Compatible with nimcall

2020-02-06 Thread Varriount
Can you post the rest of your code, including the procedure definitions?

Re: How do I extract a particular block from an external module?

2020-02-04 Thread Varriount
That's actually a rather nifty use of the include statement! I can see using that for something like generating mocks and tests.

Re: Nim calling Lemon parser and SIGSEGV

2020-02-01 Thread Varriount
Hm, have you looked at the generated C code?

Re: Overloaded proc dispatch won't work with object type

2020-01-30 Thread Varriount
A variable declared with var can be used as both a var and regular parameter. The following is valid: type Foo = object a: int proc bar(x: Foo) = echo x.a proc baz(x: var Foo) = echo x.a var y = Foo(a: 1) bar(y) baz(y)

Re: Nim calling Lemon parser and SIGSEGV

2020-01-30 Thread Varriount
It appears that (for some reason) the upper 32 bits of the tree pointer in PState.tree are being cleared. You can see this if you add printf("Node at address: %pn", (void *)e); to the mkNode functions, and then print the value of the tree pointer.

Re: Is there a help() method, or dir(), like in python?

2019-09-02 Thread Varriount
You can also use `echo repr(variable)` to print out a basic representation of a variable.

Test Post

2019-06-29 Thread Varriount
Test Text

Re: Owned refs

2019-03-27 Thread Varriount
How are the owned/unowned reference concepts different from the strong/weak reference concepts found in other languages?

Re: Httpclient and hangs

2019-03-08 Thread Varriount
It would help if we had more context for your problem. Is the server sending a lot of data? Are you using threads? What have you tried with regards to debugging?

Re: Some weird Heisenbug with the implicit result variable which results in a segfault

2019-03-07 Thread Varriount
I would double-check the ZLIB binding code that you have, to make sure that everything is correct. This looks suspiciously like a memory-corruption issue, which tends to happen when Nim bindnigs don't accurately represent the functions/structures they are wrapping. You

Re: Can I access arrays faster than this?

2019-03-04 Thread Varriount
Ok, so I was able to get the Nim and C++ examples to compile when using the heap (rather than the stack). Comparing the code, I think the difference in performance is caused by two things: * The Nim code isn't in a main procedure * The C++ code is using int`s (32 bits) while Nim is

Re: Can I access arrays faster than this?

2019-03-04 Thread Varriount
No.. I'm running it on a MacBook with 16GB of ram

Re: Can I access arrays faster than this?

2019-03-04 Thread Varriount
Hm, when I compile the C++ code, I get a segfault.

Re: Introducing Norm: a Nim ORM

2019-03-04 Thread Varriount
Are all the incoming types from the database strings? How does this handle NULL?

Re: Dereference a pointer to its underlying type

2019-03-03 Thread Varriount
Hm, are you sure you need pointers? Usually references are better (as references are tracked by the garbage collector). Also, runtime type data doesn't work like this. The is operator works at compile time. What I think you want to do is this: type NodeValueKind = enum

Re: cannot countProcessor in compile time

2018-05-22 Thread Varriount
Woops, yes, I meant to say alloca.

Re: cannot countProcessor in compile time

2018-05-21 Thread Varriount
If you _really_ need to know the number of processors on a system, you could always compile a sub-program during compile-time and invoke it. Regarding allocating arrays at runtime, is there a reason that a [sequence](https://nim-lang.org/docs/manual.html#types-array-and-sequence-types) won't

Re: Need help with macro

2018-03-26 Thread Varriount
Your setupDepFile macro can only take static parameters - the parameter values must be known at compile-time. On line 53, your are passing a string and boolean that have may have values unknown at compile-time values. Yes, the function calls on lines 54 and 55 have known values, but the

Re: ASM on Windows basically dead?

2017-12-29 Thread Varriount
Huh? Why does UE4 only work with vcc?

Re: ASM on Windows basically dead?

2017-12-29 Thread Varriount
Visual Studio support for assembly has always been tricky (if I recall correctly, it to a whole for inline assembly to be supported). Have you tried using Gcc/Mingw? That's what most people use.

Re: owerflowChecks - how to make it work

2017-12-27 Thread Varriount
>From the [compiler >manual](https://nim-lang.org/docs/nimc.html#compiler-usage-command-line-switches): \--overflowChecks:on|off \- turn int over-/underflow checks on|off

Re: Hiring Nim Devs for Ethereum Implementation

2017-12-08 Thread Varriount
Are you accepting part-time applications?

Re: Error invalid module name: nim_1.1.1

2017-12-02 Thread Varriount
geo555: I don't see how this is unexpected - Nearly all languages that have a "namespace" or "module" concept restrict namespace/module names to valid identifiers. This is so the module can be referenced within the code. * Python allows running scripts with invalid identifiers, however it

Re: Do we really like the ...It templates?

2017-11-11 Thread Varriount
I like Stefan_Salewski's version as well. It reminds me of python generator expressions.

Re: What's happening with destructors?

2017-11-09 Thread Varriount
@Udiknedorm: The biggest problem with the current GC is that it doesn't support shared memory (though, I don't know why we can't do something like Go's channels). To me, these changes seem like an effort to reasonably support programs that don't want to rely on the GC.

Re: compile time 'asserts'

2017-11-05 Thread Varriount
Well, the only way to do type checking like this is through static analysis, which is typically performed by the compiler. The other way to do this is to make a variant of a procedure that accepts static parameters, and then use when to test their value.

Re: real inline for inline procs or converters

2017-10-25 Thread Varriount
You can always run your output code through [Google Closure Compiler](https://developers.google.com/closure/compiler/).

Re: Cannot get name of type using typedesc

2017-10-24 Thread Varriount
@LeuGim Look under the line, in the same area as the 'Run' button.

Re: Execution speed Nim vs. Python

2017-09-27 Thread Varriount
Python caches hashing of strings. Nim does not (it would be a challenge, as Nim strings are mutable). I suggest using string references or Hash objects if you want to compare performance. Has anyone benchmarked C++ for this kind of test?

Re: Move semantic and manuel memory management

2017-09-12 Thread Varriount
Copying semantics in Nim are fairly straightforward: * Object types, sequences, and strings copy on assignment * References do not copy on assignment shallowCopy and shallow sidestep the fact that strings and sequences copy on assignment. If you use these procedures, any affected

Re: String slice performance!

2017-07-21 Thread Varriount
V2: import tables, times, hashes const WORD_SIZE = 4 const K = 1 iterator wordSlices(line: string, size: int): Slice[int] = for startIndex in 0 .. len(line) - size: let endIndex = startIndex + size - 1 yield startIndex..endIndex

Re: String slice performance!

2017-07-21 Thread Varriount
I've come up with an optimized version which takes about 5 seconds on my machine, vs the 48 seconds that the Python script takes. This version doesn't print out the top words (that would take a bit more work, and another map of hashes to strings) import tables, times, hashes

Re: String slice performance!

2017-07-20 Thread Varriount
Could you post your Python source code too? Often when people post these kinds of comparisons, their programs are doing slightly different things.

Re: How To - Proper Interfacing In Nim

2017-06-10 Thread Varriount
With the exception of code that is interfacing with some external language (C, C++, etc) this doesn't really make sense. Nim is module based, so you just import the types from the files you need and Nim takes care of all the type linking. If you need to use mutually recursive types, put all the

Re: How to export data to C

2017-05-25 Thread Varriount
Are you exporting a const?

Re: when will [] ambiguous be solved?

2017-05-05 Thread Varriount
It will probably be solved: * After all other higher-priority features/bugs are solved * When someone contributes a patch that resolves the ambiguity It's not really a big problem. Just use "foo[T](42)" or "foo(42)[T]". I don't think it warrants a syntax change.

Re: vcc didn't run the second spawn, any idea?

2017-05-03 Thread Varriount
It's likely that this is a bug in the threadpool implementation - I suggest you file an issue in the main repository.

Re: Creating a new seq is not that fast

2017-04-18 Thread Varriount
Probably. I wouldn't be surprised if part of the reason Nim's allocator is slightly slower is due to zeroing memory too.

Re: ref object or object with ref field

2017-04-11 Thread Varriount
Krux02: It would be better to store the index. Using addr is unsafe - the object won't have the same address if it's copied from place-to-place on the stack. mratsim: First, I would look at the section of the manual regarding [reference and pointer

Re: How to properly bind a function to a compiler buildin?

2017-04-09 Thread Varriount
What do you mean by 'bind'?

Re: File, FileDescriptor, Handle, Windows

2017-02-18 Thread Varriount
It looks like you're mixing standard C io functions with Windows IO functions, which usually leads to trouble. The standard output handle on Windows isn't exactly like a normal file handle, and doesn't sort all the states that a regular handle does.

Re: Amicable numbers in Nim and a few questions

2017-01-24 Thread Varriount
The Nim compiler knows nothing about CFLAGS and related things, however the C compiler it uses should (if you're using GCC or Clang). You can also pass in arguments via `--passC` and `--passL` arguments. When benchmarking, it's good to remember some things: * Nim's `int` datatype is

Maintainer wanted for NimLime

2017-01-17 Thread Varriount
Hello all! Unfortunately, due to a recent increase in work and educational demands, I don't have any free time left to devote to [NimLime](https://github.com/Varriount/NimLime), the Nim integration plugin for Sublime Text. As such, I'm reaching out to the community to request if there's

Re: Installation on 64-bit Windows

2017-01-13 Thread Varriount
The big problem with a self-extracting executable is that we need the capability to download extra components - namely MinGW. Bundling MinGW with all installs dramatically increases download size, not to mention that if the MinGW component needs to be updated, so does the rest of the installer.

Re: Installation on 64-bit Windows

2017-01-10 Thread Varriount
Anyway, does anyone know some alternative that we might try out? I know that we've tried WiX (too much XML), NSIS (too much assembly), and Inno (way, way too much programming needed). Any others?

Re: Installation on 64-bit Windows

2017-01-10 Thread Varriount
@mindplay I suspect the main reason for araq's vehemence is not malicious, but maintenance fatigue. The old installer used [NSIS](http://nsis.sourceforge.net/Main_Page), which is a headache to deal with (the installer is built using the NSIS language, which closely resembles assembly and a

Re: Surprises with Generics

2017-01-08 Thread Varriount
The symbol binding rules for generics are outlined in the manual [here](http://manual.nim-lang.org/docs/manual.html#generics-symbol-lookup-in-generics). It might help if the section defined what exactly 'open' and 'closed' symbols are, since most programmers don't know about compiler-specific

Re: Surprises with Generics

2017-01-07 Thread Varriount
Why should it be surprising? Procedure calls and field accesses in generics aren't resolved until instantiation time. What if wuff was a field of 'a'? Anyway, if by 'inlining' you mean, 'can the Nim compiler/backend compiler inline generics', then yes, it can be inlined. I don't quite

Re: Why do custom types need to be reference counted objects for dynamic dispatch to work.

2017-01-04 Thread Varriount
Yes, objects need to be reference counted for methods to work. This is because only reference types can point to variable-length memory regions. Take the below code: type Animal = ref object of RootObj name: string Dog = ref object of Animal

Re: Return values question

2016-12-12 Thread Varriount
> I guess that one could put the return value as the first one on the stack > frame, so there is no copy involved. It seems to me that this is safe to do > when one uses the special variable result. It depends on the calling > convention, but I think it should be doable? This is close to how

Re: Return values question

2016-12-12 Thread Varriount
**TL;DR**: Strings and sequences, like objects and integers, are copy on _assignment_. References are not. Technically, values are always copied when returned from a procedure - there's not really any other way.* If values were to be always passed by pointer/reference, how would values that

Re: Nim GC Performance

2016-12-06 Thread Varriount
Turning on cycle detection doesn't seem to affect the pause times for me. I still get sub-millisecond pauses for Araq's Nim snippet. This is the snippet I'm using: # Compile and run with 'nim c -r -d:useRealtimeGC -d:release main.nim' import strutils #import times

Re: Nim GC Performance

2016-12-06 Thread Varriount
Here's an amendment to my previous timing. I compiled the Go snippit with standard arguments (I don't know if there's a 'release' mode) and Nim with '-d:release', then ran each executable 20 times. Nim --- Mean: 0.08501 ms Median: 0.07966 ms Std Dev.: 0.03227

Re: Nim GC Performance

2016-12-06 Thread Varriount
@jlp765 It varied ±1 millisecond for the Go snippet, and ±0.1 millisecond for the Nim snippet.

Re: passing references

2016-12-05 Thread Varriount
Or if you want to compare the addresses only: echo "IS IT THE SAME? ", (cast[int](xobjref) == cast[int](result))

Re: Question about the interaction of Concepts, Generic types, and typedesc

2016-11-28 Thread Varriount
This looks mainly like an edge case that hasn't been covered. You should probably file an issue for it.

Re: messaging - or communicating between GUI's

2016-11-15 Thread Varriount
You could also roll your own mechanism via shared memory maps (although this world better for fixed-length structures).

Re: Code page 65001

2016-10-25 Thread Varriount
Personally I dislike that particular behavior. The c runtime that ships with Windows is meant for internal use. [https://blogs.msdn.microsoft.com/oldnewthing/20140411-00/?p=1273](https://blogs.msdn.microsoft.com/oldnewthing/20140411-00/?p=1273)

Re: strutils.toLower deprecation?

2016-10-12 Thread Varriount
Eh, my biggest complaint about strings is (and probably always will be) their copy-on-assignment behavior. At least UTF8 handling can be implemented fairly transparently through subtyping. (Yes, I'm aware that changing current string assignment behavior would break things)

Re: Nim Chess 2 with transposition table support is available

2016-10-04 Thread Varriount
Don't forget link-time-optimizations. Turning those on tends to make code quite a bit smaller.

Re: async I/O API: why strings?

2016-08-29 Thread Varriount
This actually puzzles me too, especially since Nim are particularly inefficient for this kind of work (strings are copy-on-assignment, meaning the data is going to be copied at least twice on its way to a socket)

Re: Send data structures between threads?

2016-08-28 Thread Varriount
@Araq This sounds like object mapping, in which data from a database is mapped into a set of objects. That's quite common, and makes working with data much easier.

Re: asynchttpserver and big request body

2016-08-27 Thread Varriount
I'd love interfaces like the ones shown by [requests](http://forum.nim-lang.org///docs.python-requests.org/en/master/) and [unirest](http://forum.nim-lang.org///unirest.io)...

Re: Send data structures between threads?

2016-08-27 Thread Varriount
@Araq By "implemented", I believe jyelon meant "design"; using existing database software (postgresql). Anyway, your reply still doesn't answer the question - how would he use json functions in one thread to act on data from another thread?

Re: Send data structures between threads?

2016-08-27 Thread Varriount
In those cases, do you really need to access the exact same memory, or will a copy do?

Re: Nim and COM

2016-07-04 Thread Varriount
Since COM has a C interface, it's quite possible (although I have yet to see a real-world example). What kind of scenario are you planning to use COM in?

Re: Jester: slow route affects other routes

2016-07-03 Thread Varriount
Jester relies on Nim's built-in async modules, which are unfortunately built on a single-threaded _asynchronous_ approach. This means any blocking operation done on the main thread will stall all operations. If your aim is to pause a route, I suggest using something like

Re: Split at an empty separator does not work

2016-07-03 Thread Varriount
I'd prefer throwing an error (or returning the original string). Splitting with a delimiter of 'nothing' makes little sense, and doesn't have an intuitive result.

Re: Concepts, name resolution and polymorphic behavior

2016-06-27 Thread Varriount
This looks to be more a limitation in the current concept implementation (although whether the limitation will be lifted is a design decision that Araq will have to make). Currently the compiler only considers globally-scoped procedures when testing of a concept "fits" a type, likely for

Re: Windows nim binaries freeze

2016-06-27 Thread Varriount
Could you retry the above actions with an elevated process explorer (one run as an administrator)? Also, do you have an Antivirus program or something similar that could be causing this? Have you had any similar problems with other programs in the past? Sorry for the questions, it's just that

Re: Windows nim binaries freeze

2016-06-27 Thread Varriount
It's possible to 'suspend' (pause) threads in various ways - a process can be created in a suspended state, a debugger can pause threads, or threads can be suspended via an undocumented kernel function

Re: Windows nim binaries freeze

2016-06-26 Thread Varriount
:

Re: Concepts, name resolution and polymorphic behavior

2016-06-26 Thread Varriount
:

Re: Windows nim binaries freeze

2016-06-26 Thread Varriount
: