Proposal: Renaming imported symbols

2020-07-28 Thread gemath
Oh right, that constraint was "unique per Nimble package" and it was lifted more than [a year ago](https://github.com/nim-lang/Nim/pull/11064/commits/85bb68c8d0d8eeb9f370b78ff54e27736e7f9ea6).

Linking neo to openblas.dll ?

2020-07-28 Thread oyster
`-d:openblas -d:blas=libopenblas` works for arraymancer too thanks

cross platform symmetric and assymetric cryptography

2020-07-28 Thread moerm
> * implementing cross-platform TLS support for a P2P protocol, and it's such > a giant pain in the butt. > Sorry but that's not the relevant point from a security perspective. From the practical point of view it of course can be a killer. What, however, _is_ an important point is that comp

Are all refs mutable?

2020-07-28 Thread Araq
Well but not every func has a `var T` parameter.

Are all refs mutable?

2020-07-28 Thread Yardanico
But even with strictFuncs you can modify arguments with explicit "var T" argument, e.g. "var int"

How do you extract a part from an initCountTable in Nim?

2020-07-28 Thread cblake
Ok. I realize I also didn't tell @Serge who never replied about needing to do `wordFrequencies.sort`. So, as penance I did this series of **_six_** successively faster versions. First would be @gemath's, then the no-deps variant. Then using the heapqueue I mentioned. Then `Table[string,int]` ins

How to ensure that all attributes of an object are explicitly set during creation?

2020-07-28 Thread digitalcraftsman
Thanks a lot.

How to ensure that all attributes of an object are explicitly set during creation?

2020-07-28 Thread inventormatt
in order to get rid of the deprecation warning place the pragma after the object name Car {.requiresInit.} = object Run and that should resolve it. as for the documentation I found that pragma in the nim manual [https://nim-lang.org/docs/manual.html](https://nim-lang.or

Are all refs mutable?

2020-07-28 Thread snej
It sounds as if the C back-end could then annotate translated funcs with `__attribute((pure))`, at least with Clang and GCC, since the semantics seem identical. I've used this attribute in some of my C++ code and it does seem to improve Clang's code generation.

"||" operator ? : Is there a corresponding operator for iterables ?

2020-07-28 Thread Serge
Here is an example: [https://nim-lang.org/docs/system.html#%7C%7C.i%2CS%2CT%2Cstring](https://nim-lang.org/docs/system.html#%7C%7C.i%2CS%2CT%2Cstring)

How to ensure that all attributes of an object are explicitly set during creation?

2020-07-28 Thread digitalcraftsman
Hello @invetormatt, thank you for your response. The {.requiresInit.} pragma looks very promising. But when executing your modified example code I get the following warning: > Warning: type pragmas follow the type name; this form of writing pragmas is > deprecated [Deprecated] Is there an alte

cross platform symmetric and assymetric cryptography

2020-07-28 Thread snej
> No, not really. OpenSSL is a cancerous abomination and a catastrophy > generator. I tend to agree; I was trying to be polite earlier :) > Second point: try to avoid SSL if any possible for quite a few reasons. I didn't use to agree with this; I figured it's best to use a battle-tested longti

How to ensure that all attributes of an object are explicitly set during creation?

2020-07-28 Thread inventormatt
Hello, I believe the {.requiresInit.} pragma may be what you are looking for. it will throw an error if the object is initialized with a missing value. type Car = object {.requiresInit.} numOfWheels: Natural numOfDoors: Natural color: string hadA

How to ensure that all attributes of an object are explicitly set during creation?

2020-07-28 Thread digitalcraftsman
Hello everyone, in the example below the initCar proc creates a new car and defines sensible default values. Now I decide to extend the car with a new attribute maxSpeed: Natural. By default the compiler will set the value of maxSpeed to 0 which doesn't make sense for cars. As module author I'm

Improving BSD support - NetBSD

2020-07-28 Thread euant
Cheers, I'll give that a go and see what happens - wouldn't have thought of that!

Improving BSD support - NetBSD

2020-07-28 Thread Araq
Try `--tlsEmulation:off`

"||" operator ? : Is there a corresponding operator for iterables ?

2020-07-28 Thread Serge
Thank you!

"||" operator ? : Is there a corresponding operator for iterables ?

2020-07-28 Thread aEverr
Where do you see this || operator? I have never seen such an operator in Nim...

"||" operator ? : Is there a corresponding operator for iterables ?

2020-07-28 Thread mratsim
This is an operator to parallelize a loop with OpenMP. Do not use `inc` on a global variable with it as there would be no synchronization and what you will get in `x` will be random.

"||" operator ? : Is there a corresponding operator for iterables ?

2020-07-28 Thread Serge
Is there a corresponding operator for iterables ? >From the snippet hereunder, I'm assuming that this operator is for dealing >with vectors (since it appears in a range expression): import strutils var x=0 for i in 1||1000: inc x echo "[$1]=$2" % [$i,$x]

Improving BSD support - NetBSD

2020-07-28 Thread euant
I've now ran the core dumps through gdb to get backtraces for them all in case somebody else has any insight into the causes: **cyclecollector.core** > gdb ./tests/gc/cyclecollector cyclecollector.core Reading symbols from ./tests/gc/cyclecollector... (No debugging symbols f

Authenticating a user in a REST webservice

2020-07-28 Thread jasonfi
>From the research I've done, JWT looks like a good solution. I found a library >for Nim: >[https://github.com/treeform/quickjwt](https://github.com/treeform/quickjwt)

Authenticating a user in a REST webservice

2020-07-28 Thread enthus1ast
I guess you have to build it yourself. I've done something like this for a websocket chat system, build on top of plain asynchttpserver. For http i basically created a (session) cookie in the browser and stored it in the servers datastore. i've done it a little different, since the websocket co

Is the rule regarding parentheses as "blocs" still valid ?

2020-07-28 Thread Serge
I see. Thank you! I actually like that alternative (or "complement") rather. I don't trust copy/paste operations when I don't have visible delimiters. For Python, I use "pindent.py" to add visible "# end for", "# end def", etc. delimiters

Is the rule regarding parentheses as "blocs" still valid ?

2020-07-28 Thread inventormatt
you example works as long as your end parenthesis on line 4 is shifted over two spaces

Linking neo to openblas.dll ?

2020-07-28 Thread Serge
It actually works! nim c -d:blas=libopenblas nim_neo_linear_algebra.nim Run it compiles and runs and uses the openblas lib installed by "pacman" under Mingw64 on Widows. That's really cool!

Is the rule regarding parentheses as "blocs" still valid ?

2020-07-28 Thread Serge
How comes, then, that this works: for i in 1..10: echo "hello" echo i Run and this doesn't: for i in 1..10: ( echo "hello"; echo i; ) Run

Improving BSD support - NetBSD

2020-07-28 Thread euant
Over the last few months I've been working to improve Nim's support for various BSD systems, including adding CI. We currently have CI for both FreeBSD and OpenBSD. I'm now turning my eyes towards NetBSD, though we don't yet have a CI platform available for it. I've set up a NetBSD virtual mach

Improving BSD support - NetBSD

2020-07-28 Thread euant
In case anybody else wishes to run the tests on NetBSD, there are a few steps to go through (these steps assume you are logged in as root): pkgin install git \ sqlite3 \ sfml \ mozilla-rootcerts \ boehm-gc \ gmake \ nodejs \ pcr

How do you extract a part from an initCountTable in Nim?

2020-07-28 Thread gemath
With zero_functional, one would add wordFrequencies.pairs() --> take(10).foreach(echo it[0] & " " & $it[1]) Run after the `sort`.

Incomplete gamma function in Nim or it's 3rd party libraries

2020-07-28 Thread wiltzutm
I was a bit too hasty writing the post. In the end I was able to circumvent the problem altogether. Sorry for the noise. Also I'm still convinced that a special functions lib like python's scipy.special would be beneficial not as a std lib but some 3rd party implementation.

Authenticating a user in a REST webservice

2020-07-28 Thread jasonfi
Are there any libraries to help authenticate a webservice built with Jester? How is everyone else doing this?

Incomplete gamma function in Nim or it's 3rd party libraries

2020-07-28 Thread wiltzutm
Yes I communicated it badly in my post. I know of the existence of the math.h gamma function. Problem is that it's the complete gamma function eg. usually called just gamma function. I need the INCOMPLETE and actually more specifically the lower incomplete version of it. This is actually the fun

Linking neo to openblas.dll ?

2020-07-28 Thread mratsim
BLAS on windows is a huge pain, and for Arraymancer as well. By the way, I think on loading a DLL, Windows doesn't automatically prefix them with "lib" so you might need to `--define:blas=openblas`.

required type seq[float or float32 or int], but expression is of type: seq[float32]

2020-07-28 Thread mratsim
Welcome to the (second) wonderful world of `distinct` proc `-`(x, y: distinct seq[float | float32 | int]): seq[float32] = discard Run Those are called the bind-many vs bind-once semantics should work though I really really really do not like this: [https://githu

Incomplete gamma function in Nim or it's 3rd party libraries

2020-07-28 Thread mratsim
I don't know the gammafunction but maybe in math.h? [https://nim-lang.org/docs/math.html#gamma%2Cfloat64](https://nim-lang.org/docs/math.html#gamma%2Cfloat64)

Incomplete gamma function in Nim or it's 3rd party libraries

2020-07-28 Thread wiltzutm
Hello everyone! I need the incomplete gamma function in my code, but I cannot find it neither from standard libraries nor 3rd party packages. Does anyone have any idea if it's implemented in some nim package? I know there's the complete gamma function in standard math. How about wrapping some e

Proposal: Renaming imported symbols

2020-07-28 Thread Araq
> Wait, was lscrd responding to a comment that has been deleted, rather than > the top comment? Yes exactly.

Proposal: Renaming imported symbols

2020-07-28 Thread gemath
Wait, module names don't have to be unique anymore?

Proposal: Renaming imported symbols

2020-07-28 Thread Yardanico
They never had to be, wdym?

Is the rule regarding parentheses as "blocs" still valid ?

2020-07-28 Thread Yardanico
There's no specific "rule" for that, but yes, this code still works just fine on latest Nim.