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

2020-01-30 Thread moigagoo
Thanks for the suggestion! Unfortunately, even the hack with generics didn't 
work in my case. Probably because one of those procs is calling the other, 
which causes this: `` Error: expression 'insert(obj, force)' has no type (or is 
ambiguous)``

Had to add a differently named proc: 
[https://github.com/moigagoo/norm/blob/feature/58_insert_for_immutable_objects/src/norm/sqlite.nim#L170](https://github.com/moigagoo/norm/blob/feature/58_insert_for_immutable_objects/src/norm/sqlite.nim#L170)

Will report the issue to Nim.


Re: Starting A Podcast: Anyone Interested?

2020-01-30 Thread davidbrok5
I'm curious...for those who run their own podcast, where are you in your 
podcasting journey? Are you just getting started or have you been doing it for 
a while? Are you trying to get your first listens or are you looking to grow 
and scale your audience?

Lastly, what's the biggest problem you're facing RIGHT NOW?

Marketing, scripting, buying equipment, editing, finding guests, etc...


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

2020-01-30 Thread solo989
Var parameters are prioritized over non var parameters when passed mutable 
values. This may be a bug due to using the the generic object typeclass. This 
code works. 


type Foo = object
  i: int
proc foo(x: Foo): int = x.i*2
proc foo(x: var Foo) = x.i*=2

let x = Foo(i: 3)
var y = Foo(i: 4)
echo foo(x)
foo(y)


Run


Re: Introducing Norm: a Nim ORM

2020-01-30 Thread JPLRouge
Bonjour, Hello

887/5000

I am passionate about DB ...
Did you think, open several connections

so if yes you can have a transactional connection and a logical connection only 
for reading ...

I work this way it allows me a lot of flexibility.

I worked on a wrapper (which works in C ++) based on Postgresql libpq.

I also did one with ECPG ... History of making a lib for each table containing 
access allowing to make the management a very functional test and a correct 
speed, this table in lib ... finally it was the materialization of fields and 
functional records identical to the AS400 DB2

I had thought of translating everything into nim, I stumbled on ECPG which 
demands absolutely "c" then converted to its sauce ... So I did not find it 
very nice for someone who uses nim 

Bon voyage in your adventure


Re: Nim calling Lemon parser and SIGSEGV

2020-01-30 Thread jdn
`.bycopy.` was originally in the pragma for all the C types. I removed any 
pragma that didn't seem to help to not obfuscate the issue. The code segfaults 
in `dump_ast` at the switch statement. The first 32 bits made me think that it 
was `ntype` a c integer that was the issue but I don't think so now. Lemon 
produces a header in this case called `calc.h` of token types: 


#define ADD  1
#define SUB  2
#define MUL  3
#define DIV  4
#define LPAR 5
#define RPAR 6
#define NUM  7


Run

which the Makefile evokes `c2nim` to create `calc.nim`: 


const
  ADD* = 1
  SUB* = 2
  MUL* = 3
  DIV* = 4
  LPAR* = 5
  RPAR* = 6
  NUM* = 7


Run

The reason I don't think this is the issue is that I hard coded the c int's to 
their actual values in both `calc.y` and `main.nim` and got the same result.

Thank you both for your input.


Re: Added Mouse support to illwill (cli) + widget library

2020-01-30 Thread JPLRouge
It's a shame not to have UTF8. You did something that holds the road ... In 
French the è etc ... oops it's not funny ;)


Re: Added Mouse support to illwill (cli) + widget library

2020-01-30 Thread enthus1ast
German umlaute (öäüß) are also not supported :). And the funny thing is, on 
windows typing them even crashes cmd.exe.


Re: FOSDEM 2020 - Brussels February 1st & 2nd

2020-01-30 Thread cdome
+1000 for London meetup


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)


Run

[https://play.nim-lang.org/#ix=28KD](https://play.nim-lang.org/#ix=28KD)

Notice that both `bar` and `baz` can be called with `y`. If the two functions 
share the same name, then the call is ambiguous, because y is valid for both 
functions.


Re: FOSDEM 2020 - Brussels February 1st & 2nd

2020-01-30 Thread dom96
That's a shame, we will miss you. Maybe this could be our excuse to have a 
meetup in London finally :)


Overloaded proc dispatch won't work with object type

2020-01-30 Thread moigagoo
Hi!

I've got this weird behavior with overloading, could anyone please advise if 
it's a bug?


INim 0.4.1
Nim Compiler Version 1.0.6 [Windows: amd64] at 
C:\Users\moigagoo\.nimble\bin\nim.exe
nim> proc foo(x: object): int = x.i*2
nim> proc foo(x: var object) = x.i*=2
nim> type Foo = object
 i: int

nim> let x = Foo(i: 3)
nim> var y = Foo(i: 4)
nim> echo foo(x)
6
nim> foo(y)
Error: ambiguous call; both inim_1580414387.foo(x: object) [declared in 
C:\Users\moigagoo\AppData\Local\Temp\inim_1580414387.nim(3, 6)] and 
inim_1580414387.foo(x: var object) [declared in 
C:\Users\moigagoo\AppData\Local\Temp\inim_1580414387.nim(4, 6)] match for: (Foo)


Run

Why can't the compiler properly find the proc to call? It works with other 
types but not object.


Added Mouse support to illwill (cli) + widget library

2020-01-30 Thread enthus1ast
Hi,

we've added mouse support to johnnovak/illwill.

It should run on linux, windows and macos.

The changes still live in my illwill fork, though.

We've also created a small illwill widget library. At the moment it has:

  * buttons
  * checkbox
  * radiobox
  * listview
  * (simple) textbox



We've tried to still give you this "immediate mode" feeling.

Please try and report if its working for you (or not :) ). If it works well, 
i'll create a pull request to merge upstream.

  * Illwill with mouse support fork: 
[https://github.com/enthus1ast/illwill](https://github.com/enthus1ast/illwill)
  * Illwill widget library: 
[https://github.com/enthus1ast/illwillWidgets](https://github.com/enthus1ast/illwillWidgets)




Re: Introducing Norm: a Nim ORM

2020-01-30 Thread zetashift
This is awesome and lovely work! Thank you.


Re: Introducing Norm: a Nim ORM

2020-01-30 Thread moigagoo
It is my great pleasure to announce Norm version 1.1.0 release: 
[https://moigagoo.github.io/norm/changelog.html](https://moigagoo.github.io/norm/changelog.html)

The biggest change addition are the procs to write migrations. With those in 
place, I can focus on writing a migration manager that will make Norm even more 
useful for real life usage.


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: FOSDEM 2020 - Brussels February 1st & 2nd

2020-01-30 Thread cdome
Apologies, I have to skip this year


Re: Nim calling Lemon parser and SIGSEGV

2020-01-30 Thread Araq
I only skimmed it, one thing that stood out is that you don't use `.bycopy` for 
your imported structs/objects. I doubt it's the cause of your crashes.


Re: FOSDEM 2020 - Brussels February 1st & 2nd

2020-01-30 Thread Araq
I'm coming too. Well you know that, don't you...


Re: What are move semantics ,rvalue and lvalue ?

2020-01-30 Thread Araq
Move semantics have pretty much nothing to do with lvalues vs rvalues, C89 has 
this distinction already and so does pretty much every imperative programming 
language; however usually using different names for the same concept.