Re: Protocol Buffer library for Nim

2018-03-30 Thread PMunch
know timotheecour on GitHub made an issue in both our repos to make us aware of each others project but for the others if you want to check out my version it can be found [here](https://github.com/PMunch/protobuf-nim)

Re: when to use 'ref object' vs plain 'object'

2018-08-24 Thread PMunch
Something which might help a bit, be sure to read the comments as well: [https://www.reddit.com/r/nim/comments/7dm3le/tutorial_for_types_having_a_hard_time](https://www.reddit.com/r/nim/comments/7dm3le/tutorial_for_types_having_a_hard_time)/

Re: Should we get rid of style insensitivity?

2018-11-21 Thread PMunch
I'm against changing this, and I think a vote is superfluous so **I do not want a vote**. When I first found Nim I though the style insensitivity was a bit strange. But the more I use it the more I like it. And after having had to write some code in C and Ruby that doesn't have it I'm even

Re: Should we get rid of style insensitivity?

2018-11-22 Thread PMunch
There's a difference between having style insensitivity and writing/editing code (either manually or by a tool) to let you write your code in different styles. You could also write a tool to achieve this in C or use define statements and the like to do the same thing.

Re: Introducing Norm: a Nim ORM

2019-03-04 Thread PMunch
This looks pretty neat! Is it possible though to define a conversion and apply it to multiple fields? Say I had a lot of dates in my database it could get tedious fast to write {.dbType: "INTEGER", parseIt: timeparser, formatIt: timeformatter.}.

Re: Dereference a pointer to its underlying type

2019-03-06 Thread PMunch
Barely anything at all, in fact I decided to run a little experiment: [peter /tmp ] $ cat test.nim import json var x = newJArray() for i in 0..10_000_000: x.add newJString("Hello world") x.add newJBool(true) [peter /tmp ] $ cat test2.nim type

FOSDEM "Metaprogramming in Nim" talk now online

2019-02-06 Thread PMunch
I recently held a lightning talk at FOSDEM and the video from that got uploaded today. If you didn't have the possibility to attend FOSDEM you can watch it here:

Re: FOSDEM "Metaprogramming in Nim" talk now online

2019-02-06 Thread PMunch
Thanks, and yeah we talked about that before the talk but my mind completely blanked on that when I was on stage.. I chose the mixed audio source though, so it should've included just about enough of the audio to make out the questions. Maybe I should transcribe them under the video though..

Re: FOSDEM "Metaprogramming in Nim" talk now online

2019-02-06 Thread PMunch
Thanks a lot, but damn I was sure I heard you say that at some point!

Re: FOSDEM "Metaprogramming in Nim" talk now online

2019-02-18 Thread PMunch
Yeah that was the goal. With only 15 minutes there's only so much you can do, but I hope I managed to pique the interest of someone in the audience :)

Re: Nested sequences in Nim, how to?

2019-08-14 Thread PMunch
The answer to this is to use object variants [https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants](https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants) which is exactly what the JSON module does:

Re: Can I throw errors with custom fields?

2019-08-26 Thread PMunch
Of course, just add the fields to your exception type: Nim type MyException = ref object of Exception extraData: string proc raiseSomething() = var e: MyException new(e) e.extraData = "Hello world" e.msg = "This is the normal

Re: rumpkernel or baremetal runtime to run Nim program standalone

2019-08-23 Thread PMunch
If you disable the garbage collector and does some tweaks Nim is able to run on microcontrollers such as an Arduino or Attiny85. So it's definitely possible to run bare metal. There has even been an OS demonstrator written in Nim:

FOSDEM 2020 Newer languages developer room

2019-08-21 Thread PMunch
Hi everyone. For the past couple of years Nim has had some presence at FOSDEM, and this year we want to things a bit further. The original idea was to apply for a Nim developer room, but fearing that it would be too niche to get accepted, I propose the idea of creating a joint effort "Newer

Re: How to Maintain a Nim Chinese Community

2019-12-03 Thread PMunch
Recently discovered this site: [https://nim-cn.com](https://nim-cn.com) which appears to be a translated version of the main page. As for a forum I don't think there is anything like that, but as others have said it is possible to use this open source forum and just set up a new version.

Re: Nim is the friendliest language to start

2019-12-03 Thread PMunch
For web framework using Jester + Karax is a fairly solid combination. Or if you don't want a single page application then Jester + your web DSL of choice.

Re: FOSDEM Call for Participation

2019-10-18 Thread PMunch
Well, this has already been mailed out, so we can't really change it for everyone. And thanks for making me aware of that list and the missing name, it was supposed to be an automatic thing, but we have a PR in to fix it now.

Re: FOSDEM CfP deadline is 26/11/19

2019-11-22 Thread PMunch
Beat me to it, was about to put up a reminder today :)

Re: Announcement: Use Nim for programming on Bluetooth chips

2019-11-14 Thread PMunch
Very cool to see that you are supporting Nim! There aren't a whole lot of users on these kind of platforms using Nim yet, but as you mentioned there are some really good reasons to do it

Re: GC_ref & GC_unref - and when to use them

2019-11-14 Thread PMunch
GC_ref and GC_unref are required when your Nim code needs to be responsible for keeping track of memory, but you might end up passing things in and out of Nim code. In general they aren't used a whole lot for regular C interop. The important thing to keep in mind here is who is

Re: ui TABLE error

2019-10-07 Thread PMunch
Well it does require Gtk3..

Re: FOSDEM Call for Participation

2019-10-14 Thread PMunch
Well, it was expanded from last years description from the "Minimalistic languages" room. The official title of the room is "Minimalistic, experimental, and emerging languages", and the focus of the room really is on any language that don't have a home in any of the other programming language

Re: FOSDEM Call for Participation

2019-10-14 Thread PMunch
Oooh, I would love to see that talk!

Re: FOSDEM Call for Participation

2019-10-11 Thread PMunch
This room is a merger of our proposed "Emerging languages" devroom, and the "Minimalistic languages" devroom from last year :)

FOSDEM Call for Participation

2019-10-11 Thread PMunch
We are excited to announce a devroom on minimalistic, experimental and/or emerging languages (with big ideas) at FOSDEM on Sunday February 2nd 2020! FOSDEM is one of the most important free software conferences and is hosted annually at Université libre de Bruxelles in Brussels, Belgium. FOSDEM

Re: How does one use switch for optional types?

2020-03-06 Thread PMunch
I've written a library for options that does exactly this, amongst other useful things with options: [https://nimble.directory/pkg/optionsutils](https://nimble.directory/pkg/optionsutils)

FOSDEM 2020 - Brussels February 1st & 2nd

2020-01-28 Thread PMunch
It's that time of year again, when all sorts of open source interested people meet up in Brussels for a free to attend conference with 835 lectures and over 8000 participants! This year Nim is more active than ever before with four talks over an hour and a half. This will all take place in the

Re: Compile time FFI

2020-02-04 Thread PMunch
My biggest reason for wanting FFI at compile-time is to be able to use libraries that are wrappers around C libraries. For example for my Arduino stuff I wrote a macro that reads an image file and converts that to an array of bytes that is directly inserted into your code (this is how sprites

Re: Is this expected behaviour?

2020-01-15 Thread PMunch
I agree that it should be an explicit thing (by using static(myCompileTimeValue)), but mostly because the compiler can then show you an error if you do this by accident.

Re: Why does this proc have side effects?

2020-01-17 Thread PMunch
To expand a bit further the `rand` procedure updates the global random state object. If you still want a random in this case you can use the [initRand](https://nim-lang.org/docs/random.html#initRand%2Cint64) to create your own random state object and then pass that to `rand` like so:

Re: v1.2 fails to compile "==" for standalone & gc=none

2020-04-16 Thread PMunch
It seems like your issue is elsewhere, I tried myself with your cfg and code, and with this panicoverride.nim: proc rawoutput(s: string) = discard proc panic(s: string) = discard Run

Re: E-mail newsletter for blog

2020-04-01 Thread PMunch
Something like this might interest you: [https://blogtrottr.com](https://blogtrottr.com)/

Re: Idea: Nim Online Conference

2020-03-30 Thread PMunch
I'd be happy to hold a presentation. Not quite sure on what topic though.. And @treeform, are you launching rockets with Nim now?

Re: Is there a way to iterate over a set?

2020-04-01 Thread PMunch
Well for your specific usecase you can use [sample]([https://nim-lang.org/docs/random.html#sample%2Cset%5BT%5D](https://nim-lang.org/docs/random.html#sample%2Cset%5BT%5D)) from the random module. Otherwise the [manual

Re: import vs include

2020-04-30 Thread PMunch
> Now it becomes a different problem of information hiding. Do I want to have > these fields visible by users? Are there problems using import? I suppose > that if I import bar.nim in multiple files, I would get types > redefinitions... I have to balance the advantages of both solutions. As

Re: Change Nim colour on GitHub

2020-05-18 Thread PMunch
The crown has some history behind it though. It's based on the old name "Nimrod", which was the biblical king who supposedly built the tower of babel. So along with being a neat and clean logo it also encapsulates the roots and initial goal of Nim.

Re: hello world execute on openwrt

2020-05-18 Thread PMunch
Well it isn't able to find the hello executable. Did you copy it over? Did you copy it over to the place you thought you did? Are you standing in the correct folder?

Re: Nim lang for Raspberry Pi devices

2020-03-18 Thread PMunch
How are you trying to read from the serial in Nim?

Re: advanced `nim doc` use

2020-06-29 Thread PMunch
I think the most common way of doing this is splitting everything into their own modules, then include-ing them (instead of import-ing them) into the main file that the user can import. This means that the main documentation will have all the things that the various sub-modules have.

Re: Exporting string functions from DLLs

2020-06-15 Thread PMunch
As @Javi alluded to NimMain is what sets up the GC. So without calling NimMain the GC won't work and thus no Nim strings as they require the GC. It's worth noting though that \--noMain only removes the call to NimMain, the procedure is still generated. So you can import it into your Nim code as

Re: Using a Table as an object's member.

2020-06-10 Thread PMunch
Not an example, but here is a blog-post that touches on what refs are: [https://peterme.net/nim-types-originally-a-reddit-reply.html](https://peterme.net/nim-types-originally-a-reddit-reply.html)

Re: Nim in business

2020-06-07 Thread PMunch
Depends heavily on what kind of APIs you're thinking about. For the simple stuff it's good, but you might run into it lacking a package for a certain protocol or similar if you need to do something more complex.

Re: How to properly construct a ref type inside Option in functions?

2020-06-04 Thread PMunch
Note that an Option[ref T] is just a thin wrapper that checks if the reference is nil: [https://nim-lang.org/docs/options.html#Option](https://nim-lang.org/docs/options.html#Option). Wrapping something that is a pointer in an Option is simply a way to get Option semantics for pointers.

Re: Uncle Bob - one syntax to rule them all?

2020-06-04 Thread PMunch
I liked the idea of that parser so I threw together an even better Nim version: [https://play.nim-lang.org/#ix=2ogb](https://play.nim-lang.org/#ix=2ogb). It parses the format on compile-time and creates a parser that returns a tuple with all the arguments. So now all the arguments have the