inline asm err?

2019-02-06 Thread medu
proc addInt(a,b:int):int {.asmNoStackFrame.} = asm """ mov eax, `a` add eax, `b` ret """ echo addInt(3,4) Run The above results run to 0.,I hope someone can help me. thanks

Re: What's up with 19.4?

2019-02-06 Thread Araq
With 0.19.4 we now ship the nightly builds which introduced new problems. Working on a fix.

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

2019-02-06 Thread akavel
As a newbie coming into Nim just this very week (with extensive background in C++, Go, & many more): * I found the "Nim by Example" \+ the manual surprisingly approachable, easy to read and generally "good enough"; also, using the manual as a reference/searching is acceptable (it's good that

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

2019-02-06 Thread cblake
@akavel \- you may (or may not) have noticed the "Group By Type" drop-down menu on the doc page for any given module (e.g. clicking on `tables` from `theindex`). That's sort of like what you're asking for. The big `theindex.html` doesn't have that Group By feature, but perhaps should. The optio

Re: inline asm err?

2019-02-06 Thread slangmgh
Look at the assembler code: @addInt_WYbpHhMOLfd0wzp13vORMw@8 PROC NEAR mov eax, dword ptr [ebp-4H] ; 0020 _ 8B. 45, FC add eax, dword ptr [ebp-8H] ; 0023 _ 03. 45, F8 ret

Re: inline asm err?

2019-02-06 Thread slangmgh
Add the pragma `.cdecl.` or `.stdcall.` to addInt doesn't change the type nim compiler treat the parameter of addInt, maybe this is the bug.

Re: safe way to hold traced reference of unknown type?

2019-02-06 Thread yglukhov
It's true that the implementation relies on the knowledge of the GC internals. Afaik, all nim GCs should be fine with it. And likely, it's gonna stay that way for the foreseeable future, but no warranties from me :).

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

2019-02-06 Thread akavel
As to "index" \- sorry, I used bad term here, I now understand. I didn't mean "theindex", I meant the "ToC" shown in the left-side pane on e.g. [https://nim-lang.org/docs/system.html](https://nim-lang.org/docs/system.html) \- the big list of links just below the "Group By" selection box. I tried

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

2019-02-06 Thread Stefan_Salewski
> Also, I do see type signatures But in the module docs there is no type signature, for example in [https://nim-lang.org/docs/tables.html#merge%2CCountTable%5BA%5D%2CCountTable%5BA%5D](https://nim-lang.org/docs/tables.html#merge%2CCountTable%5BA%5D%2CCountTable%5BA%5D) there is proc getOrDefault

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: [https://peterme.net/meta-programming-in-nim-fosdem-talk-companion-post.html](https://peterme.net/meta-programming-in-nim-fosdem-talk-

Re: inline asm err?

2019-02-06 Thread Araq
Doesn't `asmNoStackFrame` mean that you're on your own completely, even getting the calling convention right? Which defaults to `fastcall` on win32 though.

Re: pros/cons of dissecting types via getTypeInfo() vs getTypeImpl()?

2019-02-06 Thread deansher
Should I submit a PR to capture what you, @Araq, just said in some appropriate way in the typeinfo documentation?

Re: pros/cons of dissecting types via getTypeInfo() vs getTypeImpl()?

2019-02-06 Thread Araq
Sure thing, thanks!

Re: safe way to hold traced reference of unknown type?

2019-02-06 Thread deansher
As I write my own code, I feel as though I'd want to either avoid this (perhaps instead using the approach I showed at the opening of this thread) or PR a documentation change that blesses it. Thoughts on which is better?

Re: inline asm err?

2019-02-06 Thread slangmgh
If the `asmNoStackFrame` disable any call convention pragma, a warning is required when it is combined with call convention pragma or the code refer the parameter name.

Re: inline asm err?

2019-02-06 Thread slangmgh
But I think maybe we can specify calling convention, so the following code may correct: asm """ mov eax, `a` """ Run Otherwise, we cannot refer the parameter in the assembler code. But it still make sense, because the vcc compiler treat the __declspec(naked

Re: FOSDEM "Metaprogramming in Nim" talk now online

2019-02-06 Thread kaushalmodi
Your presentation skill is great! Your speech was calm, relaxed and clear. Minor comment: Can you repeat/summarize the questions from the audience next time (yes, I am looking for more of your talks :))? The actual questions are never audible in such conferences. Thanks!

Re: FOSDEM "Metaprogramming in Nim" talk now online

2019-02-06 Thread Araq
I like it very much, your calm way of presenting Nim is very nice. Minor nitpick: "as flexible as Perl" wasn't my goal. :D

Re: inline asm err?

2019-02-06 Thread Araq
Sure but maybe don't use pragmas you don't understand. `asmNoStackFrame` screams "I know what I'm doing" to me.

Re: standalone with strings

2019-02-06 Thread Araq
The real question is here why you need --os:standalone. What feature/implementation detail of system.nim prevents you from using it in its standard setting?

Re: Error: ... .tag effects differ

2019-02-06 Thread Araq
Is that with Nim devel? I just pushed something to mitigate this issue.

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-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.. And

Re: standalone with strings

2019-02-06 Thread markprocess
Well, I started with os:standalone because Ultibo does not have a linux api so I can’t use os:linux nor any of the other choices. Perhaps what I don’t know is how to link a memory-only (no os calls) nim program to ultibo. What would be easiest would be for the nim entry point to receive a large

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

2019-02-06 Thread cblake
@akavel \- you're welcome. @both \- I'd have to agree that in a language like Nim which relies heavily on type-based overloads that long lists of the same ident in that side-bar/ToC section is not helpful. Right now each is a hyperlink to the specific one. So, collapsing would remove that choic

Re: Error: ... .tag effects differ

2019-02-06 Thread akavel
Cool! No, not devel; I'm a total newbie to Nim, so I just downloaded 0.19.4 on Windows this week and am trying to use it. Is there some approachable way I can try using the mitigation and continue developing/porting my code (from Rust)?

Re: Error: ... .tag effects differ

2019-02-06 Thread Stefan_Salewski
> Is there some approachable way I can try using the mitigation Many, maybe most people are using latest Nim devel, see [https://github.com/nim-lang/Nim#compiling](https://github.com/nim-lang/Nim#compiling)

Re: Error: ... .tag effects differ

2019-02-06 Thread akavel
Cool, thanks a lot, I'll try it then!

Re: Error: ... .tag effects differ

2019-02-06 Thread akavel
I'm afraid there seems to be still the same issue :( Not sure if it matters, but if the error message is correct, the difference seems to be in the locks: 0 phrase, not in the ReadIOEffect etc. that were changed in the recent commit. Or is it more complicated than I think?

Is there a way to make kind of like an override named block?

2019-02-06 Thread treeform
I would like to have some thing like this override/section thingy bellow: If I have just a section named "redbox" I just want it to act normally with no substitution: section "redbox": echo "boring stuff" Run But if I have an override block, some where in the co

Re: Is there a way to make kind of like an override named block?

2019-02-06 Thread solo989
This essentially does what you want. template override(a, b : untyped) : untyped = template a() : untyped = b template section(a, b : untyped) : untyped = when compiles(a()): a() else: b override redbox: echo "this is

Unexpected async behaviour?

2019-02-06 Thread dawkot
import asyncdispatch, asyncnet template asyncDo(x) = asyncCheck (proc {.async.} = x)() let s = newAsyncSocket() s.setSockOpt(OptReuseAddr, true) s.bindAddr Port 12345 s.listen let c1, c2 = newAsyncSocket() for c in [c1, c2]: asyncCheck c.connect

Re: Is there a way to make kind of like an override named block?

2019-02-06 Thread solo989
I thought of another way to solve that doesn't produce side effect templates. import macros import tables var overrides {.compiletime.} = initTable[string,string]() macro override(a, b: untyped) : untyped = var x = genSym(nskTemplate) overrides[a.strVal]

vecctor items iterator

2019-02-06 Thread tbutton
this iterator does not works items*[T](a: var Vector[T]):var T = for i in 0..a.size: yield a[i] Run when I writing this loadedmesh in this.objdata.LoadedMeshes: Run where this.objdata.LoadedMeshes is vector, that uses my iterator. co

Re: Is there a way to make kind of like an override named block?

2019-02-06 Thread treeform
Wow this is great. I really like the two approaches you made. Thank you!

Re: FOSDEM "Metaprogramming in Nim" talk now online

2019-02-06 Thread Libman
>From Araq's blog — [Nim and Perl](https://nim-lang.org/araq/perlish.html) — > Last month I tried to reimplement Perl in Nim and to see how well Nim's macro > system holds up for unusual domain specific language requests. **Personally I > do not like Perl at all** , but for a language designer i

Re: Nimrod support in Geany editor

2019-02-06 Thread Libman
I'm all for Nim support in Geany, but focusing on [the most popular IDEs](http://pypl.github.io/IDE.html) first would be most beneficial... Support in IntelliJ and Visual Studio (Proprietary, not Code) is lacking...

Re: FOSDEM "Metaprogramming in Nim" talk now online

2019-02-06 Thread lotzz
Nice, for the amount of time you had it was a good taste of what nim can do. Not really how to do it but it should get people interested in that

Re: vecctor items iterator

2019-02-06 Thread miran
> `for i in 0..a.size:` Just a basic remark, and others, who are more experienced with C++, can help you with the rest: `..` is inclusive range, here you need to use `..<`.