Re: "First natively compiled language with hot code-reloading at runtime"

2019-04-30 Thread def_pri_pub
Hey, a while back I wrote an article on this subject: [https://16bpp.net/page/hot-loading-code-in-nim](https://16bpp.net/page/hot-loading-code-in-nim) Neat work you've done though.

Geometry Library

2019-02-19 Thread def_pri_pub
I know there are packages out there such as `glm` (which I'm already using). But are there any good **pure Nim** packages/libraries for doing geometric computations? I'm looking to target JS.

Re: "Nim needs better documentation" - share your thoughts

2019-01-14 Thread def_pri_pub
I think the Leap Motion C API docs look quite nice: [https://developer.leapmotion.com/documentation/v4/index.html](https://developer.leapmotion.com/documentation/v4/index.html)

SQL modules args/string santization

2019-01-12 Thread def_pri_pub
I've been playing around with the db_sqlite module a bit. Looking at the procs for exec() and getRow()/getAllRows() It can take an option args parameter. are these arguments automatically sanitized for me, or do I manually need to do it myself. I'd like to avoid a "Bobby Tables" incident in the

Re: "Nim needs better documentation" - share your thoughts

2019-01-11 Thread def_pri_pub
Hi, it's been a while since I posted here in the community (or done much with Nim), but here at least is my $0.02: I'm not a big fan right now of how inline documentation comments/strings work. 1. This may be more of a personal preference, but I don't like putting the documentation right in

Re: Binding a JavsScript object that's not part of the DOM

2018-05-15 Thread def_pri_pub
Does it live update to when the style changes? That's one of the benefits CSSStyleDeclaration is that if you change the CSS for an object, you don't need to query for the style declaration again.

Binding a JavsScript object that's not part of the DOM

2018-05-13 Thread def_pri_pub
I'm writing an app right now and I need to figure out what the width & height of div, with it's applied CSS styling. Back in vanilla JS, there is the function [getComputedStyle()](https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle) which will give me

Re: Nim and hot loading - any experiences to share?

2017-10-01 Thread def_pri_pub
Sorry for the belated reply. I'm a little confused at what you're trying to achieve here. Can you explain it in a few words what you want? It it something with trying to get dynamically allocated memory to place nice with hot-loaded code?

Re: Nim and hot loading - any experiences to share?

2017-09-24 Thread def_pri_pub
I wrote this article a while back: [https://16bpp.net/page/hot-loading-code-in-nim](https://16bpp.net/page/hot-loading-code-in-nim)

Re: Using `string` vs `seq[uint8]` for non-text data

2017-09-21 Thread def_pri_pub
Sorry to be a bit of a pest, but I want to know if this is the thing I should be doing or not for my Nim code now?

Re: Using `string` vs `seq[uint8]` for non-text data

2017-09-19 Thread def_pri_pub
Okay, that sounds better to me. So for in my case with my stb_image wrapper, should I switch the API now to use seq[byte] or should I hold off on it for a little longer?

Using `string` vs `seq[uint8]` for non-text data

2017-09-17 Thread def_pri_pub
This stems from some discussion I've had on the stb_image bindings: [https://gitlab.com/define-private-public/stb_image-Nim/issues/4#note_40535183](https://gitlab.com/define-private-public/stb_image-Nim/issues/4#note_40535183) I'd like some discussion on the use of the string datatype for

Re: Killing an AsyncHttpServer

2017-09-09 Thread def_pri_pub
Yeah, I have the killServer = true in a block somewhere. Adding return after server.close() does work, but I need to mark server with {.threadsafe.}. It also causes an issue with the HTTP Request (on the browser side) doesn't get finished and just hangs. Interestingly enough this doesn't

Re: Killing an AsyncHttpServer

2017-09-06 Thread def_pri_pub
It now compiles successfully, but it doesn't seem to be killing the server when I trip that killServer block. It will run over the line and continue on with execution.

Killing an AsyncHttpServer

2017-09-05 Thread def_pri_pub
So I've got some code like this: import asyncDispatch import asynchttpserver # Create the server object and state data var server = newAsyncHttpServer() let port = 8000 # ... proc handleRequest(req: Request) {.async.}= ## Handle an

Re: Having a hard time getting raylib bindings to work

2017-08-10 Thread def_pri_pub
So this is a fun issue now... I've gotten the bindings to work, but when you want to do something with Textures, they won't display on the screen. The raylib tracelog says everything is okay when it came to loading the assets. I'm tracking the issue here:

Re: Having a hard time getting raylib bindings to work

2017-07-25 Thread def_pri_pub
Taking a look [at the man page for dlopen(3)](http://man7.org/linux/man-pages/man3/dlopen.3.html), I think the easiest thing to do would to be to wrap the dlopen() call in the Nim code in something that sets and then resets the LD_LIBRARY_PATH environment variable. Taking a look at the

Re: Having a hard time getting raylib bindings to work

2017-07-24 Thread def_pri_pub
I consider it something that Nim should be concerned about. It's already caused me a fair bit of grief trying to get the bindings working on Linux and I'm sure anyone else will run into the same issue down the road. Keep in mind it's not my .so that it was failing to find, but an .so that mine

Re: Having a hard time getting raylib bindings to work

2017-07-24 Thread def_pri_pub
I think I figured out why setting export LD_LIBRARY_PATH=/usr/local/lib was necessary to make it work. [The dlopen() function](http://man7.org/linux/man-pages/man3/dlopen.3.html) is used under the hood for the dynlib macro on Linux. dlopen() will not search /usr/local/lib by default. It needs

Re: Having a hard time getting raylib bindings to work

2017-07-23 Thread def_pri_pub
I use ubuntu (well, xubuntu... technically). I doubt it's a bug on their side. Someone else would have tripped over this way before I would have and fixed it too.

Re: Having a hard time getting raylib bindings to work

2017-07-22 Thread def_pri_pub
I've been able to get the Nim bindings to work on Linux using .so files!! There is still a bit of an odd quirk: 1. GLFW 3.2.1 needs to be installed (with cmake -DBUILD_SHARED_LIBS=ON) from source (sudo make install). So those get put in /usr/local/lib 2. raylib needs to be installed (with

Re: Having a hard time getting raylib bindings to work

2017-07-21 Thread def_pri_pub
I found out some more information about the issue on Linux. If you read the link to my edited post at the top it explains a little more. tl;dr the raylib.so Linux .so is broken.

Having a hard time getting raylib bindings to work

2017-07-20 Thread def_pri_pub
I'm trying to get some Nim bindings for [this neat little game programming library called raylib](https://github.com/raysan5/raylib/). But well, I'm having some difficulties trying to do so. After cleaning up raylib.h, I was able to use c2nim to auto-generate a .nim. I commented out a few

Re: Games made in Nim

2017-05-18 Thread def_pri_pub
I made a game called "Pucker Up," for the Linux Game Jam 2017. The original entry's source can be found here: [https://gitlab.com/define-private-public/LGJ2017](https://gitlab.com/define-private-public/LGJ2017) I also was able to (with moderate ease) pull out the OpenGL & SDL2 stuff, and

Re: The Linux Game Jam 2017 - itch.io

2017-03-22 Thread def_pri_pub
I was looking into using that stuff to port what I did for the Game Jam to JS, but I was wondering about how to get SDL_Mixer compiled to JS.

Re: The Linux Game Jam 2017 - itch.io

2017-03-22 Thread def_pri_pub
Also, I can't remember who here runs the Hookrace.net blog, but they talked about how they got NimES their (Nim & SDL2 NES emulator) ported to JavaScript: [https://hookrace.net/blog/porting-nes-go-nim](https://hookrace.net/blog/porting-nes-go-nim)/

Re: The Linux Game Jam 2017 - itch.io

2017-03-22 Thread def_pri_pub
Also, I can't remember who here runs the Hookrace.net blog, but they talked about how they got NimES their (Nim & SDL2 NES emulator) ported to JavaScript: [https://hookrace.net/blog/porting-nes-go-nim](https://hookrace.net/blog/porting-nes-go-nim)/

Re: Mascot

2017-03-17 Thread def_pri_pub
> Honey badgers are admired precisely for their capacity and inclination to do > violence. A Nim honey badger should look meaner than most I'd think. Should we have it ripping apart a Snake? Or gnawing down on a Gopher?

Re: Mascot

2017-03-17 Thread def_pri_pub
@jester, those designs do look a lot better IMO.

Re: Mascot

2017-03-17 Thread def_pri_pub
Aww man, and here I was hoping for some sort of cutesy anime girl for a mascot. Oh well : P (Just kidding) I think having a mascot is a good idea, but I don't think that having him front and center everything would be good. Having the crown logo in more places would be better. I also think the

Re: Trouble with reading from stdin

2017-02-10 Thread def_pri_pub
Is it something related to stdin's default buffer size? Default is around 4096 character IIRC.

Re: Trouble with reading from stdin

2017-02-09 Thread def_pri_pub
When I ran a debug build, I got this stack of errors: Traceback (most recent call last) random_art.nim(185) random_art equationParser.nim(51) parseEquation equationParser.nim(73) buildEquation ModExpr.nim(72) buildMod equationParser.nim(75)

C#/Java like interfaces for Nim

2017-01-21 Thread def_pri_pub
One of my favorite things from C#/Java are interfaces and I've been trying to work on writing some macros can generate an interface and allow you to implement it. So far I've played around with getting some sort of "toy interface," working as well as some of the macros too. Here is my initial

Re: Problems making a library and importing it

2017-01-12 Thread def_pri_pub
You need to add the export marker right after the proc's id. Try this: proc testEcho*() = echo "hello world" You can also drop that : void part too.

Re: Nim Podcast

2017-01-09 Thread def_pri_pub
Sounds like a cool idea, but I'd be interested in reading a newsletter first.

Re: Seq with custom fields

2017-01-04 Thread def_pri_pub
You will need to add this proc for the add: proc add*(es: var ExtSeq; x: int) {.inline.}= es.s.add(x) The inline pragma isn't necessary, but it speeds things up a little. For using the index tokens ([ and ]), you just need to override that proc too: # Get

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

2017-01-04 Thread def_pri_pub
Wow. Thanks for that post. I think this belongs in the docs somewhere or on a wiki. I came across this issue when I was change the prototype of a base method but forgot to change one of the child objects. So for that specific child object it was using the base method. Would using the base

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

2017-01-04 Thread def_pri_pub
Let's have a code example. When I'm using ref object of ... This code: type Animal = ref object of RootObj name: string method makeNoise(this: Animal) {.base.} = echo "..." type Human = ref object of Animal Dog = ref object of

Re: Getting a segfault when testing my C wrapper on OS X

2016-12-29 Thread def_pri_pub
I put the source of the header in it's own .nim file so my users wouldn't have to add a \--cincludes: option at the compilation step. I do find it odd that import had different behavior on Linux vs. OS X in regards to this, and it effected a return value.

Re: Getting a segfault when testing my C wrapper on OS X

2016-12-29 Thread def_pri_pub
Well, I got the unit tests run without any segfaults (on OS X). On a whim, I decided to change the import stb_image_header line (in stb_image.nim) to use the include statement instead; it worked. Is this a bug I should report?

Re: Getting a segfault when testing my C wrapper on OS X

2016-12-27 Thread def_pri_pub
Alright, I tried that and it does echo out a pointer address (e.g. 0xFFff08b7e). Where this is getting kind of weird for me is that I have this raytracer that I'm working on that uses stb_image.h as well and it able to load an image on OS X without throwing a seg fault. The code for the

Re: Getting a segfault when testing my C wrapper on OS X

2016-12-26 Thread def_pri_pub
It shouldn't be an issue with the test suite. I added this line right after the let data = stbi_load(... call echo x echo y echo channels_in_file echo data.repr And it gave me this output: 2 2 4 Traceback (most recent call last)

Getting a segfault when testing my C wrapper on OS X

2016-12-22 Thread def_pri_pub
I'm working on my stb_image wrapper right now. It's almost ready for release. But to be a good little developer I want to test it on the three major platforms (Linux, OS X, and Windows) before saying it's v1.0. I developed it on Linux and it passes all of the unit tests. But when I tried to

Re: How to embed a header file into a .nim file

2016-12-17 Thread def_pri_pub
I went with yglukhov's solution (since it seemed to be the simplest to use), but It's really what I wanted to avoid doing.

Re: Return values question

2016-12-12 Thread def_pri_pub
Thanks for that post, it definitely gave me a lot of insight into what is going on in Nim. I'm working with a lot of pixel data and wanted to return it from a function as a seq[uint8]. I want to avoid it doing an necessary copy (on return) for a lot of data (which I assume is happening right

Return values question

2016-12-12 Thread def_pri_pub
How does Nim return values from a proc? Are basic datatypes (like int and float) returned by copy? What about more complex structures like sequences and strings? For example, would this proc: proc fillWith(n, count: int): seq[int] = var s: seq[int] = @[] for i in

Best way to represent pixel data in Nim

2016-12-05 Thread def_pri_pub
I want to work on a [stb_image](https://github.com/nothings/stb/blob/master/stb_image.h) wrapper. I'm trying to figure out the best (and most efficient) way of storing pixel data in Nim's data structures. stb_image stores the pixel data in an unsigned char * type. I had a chat with the person

Problems trying to wrap a single header file library

2016-11-28 Thread def_pri_pub
I'm working on porting over some ray tracing code from a C++ project. So far things have been fine, but they used this library called [stb_image.h](https://github.com/nothings/stb/blob/master/stb_image.h) to load in textures. I thought I would try to create a wrapper for the single function

Bitwise operation problems.

2016-11-27 Thread def_pri_pub
I'm trying to map my "quadruplet" object to an unsigned 32-bit number, that is supposed to represent an RGBA pixel. I'm able to convert my floating point quadruplet values to their respective R, G, B, and A components, but when I try to do an and on all of the components, I'm getting a 0. Here

Re: Converting a nim string to a ptr GlChar

2016-11-25 Thread def_pri_pub
That second one "with force," is what did the trick. (That first one didn't compile). Thanks!

Converting a nim string to a ptr GlChar

2016-11-19 Thread def_pri_pub
Right now I'm trying to get a simple OpenGL ES example working with Nimious' GL ES bindings. I'm hitting a bit of a wall when trying to get the proc glShaderSource() to accept my shader's source code (which is gotten through the readFile() proc, which outputs a nim string). Here is a link to

Re: "Error: expression has no address" issue with an array type

2016-11-19 Thread def_pri_pub
Oh, did not know that. Thanks! I didn't find any mention of that in the Nim manual, it might be something to add here:

"Error: expression has no address" issue with an array type

2016-11-19 Thread def_pri_pub
Right now I'm trying to do a very tiny OpenGL in nim. I'm at the stage where I need to bind my buffer data. The compiler is giving me this error: Error: expression has no address Here is the C code I'm trying to port: float points = [ 0.0, 0.5, 0.0,

Re: How to iterate through a file using readLine()

2016-11-17 Thread def_pri_pub
No, that's for the proc that returns a boolean. I meant for the one that returns a TaintedString.

Re: How to iterate through a file using readLine()

2016-11-17 Thread def_pri_pub
Thanks. What would readLine() return though (using the proc I linked) if it reached EOF?

How to iterate through a file using readLine()

2016-11-17 Thread def_pri_pub
I know that this exists to cover what I want to do: for line in lines filename: echo line But how would I go about it using the [readLine() function here](http://forum.nim-lang.org///nim-lang.org/docs/system.html#readLine,File)?