Re: Nim based Github Actions

2019-11-16 Thread mratsim
You can add your contribution to the wiki. [https://github.com/nim-lang/Nim/wiki/BuildServices](https://github.com/nim-lang/Nim/wiki/BuildServices) This reminds me that both Nim and Status are using Azure Pipelines extensively and we could add it. Similarly, FreeBSD and OpenBSD CI via Sourcehut

Re: Advice on how to handle: "global using GC'ed memory"

2019-11-16 Thread mratsim
Yes you can ignore those warnings when you don't have threads on. They may have be put in place for future compat with the threadpool module.

Re: Multi-method wrongly dispatches to base

2019-11-16 Thread mratsim
Seems like there is a bug, if you comment out the first method you get type Token* = ref object of RootObj position*: int DigitToken* = ref object of Token value*: uint NumberToken* = ref object of Token value*: int # method joinToken

Re: Use stdin with nim check

2019-11-16 Thread Araq
Huh? `nim check` shouldn't read from stdin. At all. Ever.

Re: --gc:regions: how does it work?

2019-11-16 Thread Araq
It doesn't work (see the open bugs about it), it's not a GC and we don't work on it, see [https://github.com/nim-lang/RFCs/issues/177](https://github.com/nim-lang/RFCs/issues/177) You're better off understanding Nim's memory management, why you cannot interface with Flex/Bison in the way you do

--gc:regions: how does it work?

2019-11-16 Thread drkameleon
For one reason or the other, the only GC that works (and very efficiently in terms of speed - aside from too much average memory consumption in some cases) with my current project is "regions". The thing is I decided to go with that only because it works. However, I'm still not sure how it's wo

Re: --gc:regions: how does it work?

2019-11-16 Thread drkameleon
re: "why you cannot interface with Flex/Bison in the way you do and pick a different, real GC" I would be grateful if you could give me some... pointers to the right direction. Even the integration of Flex/Bison was a hit'n'miss mission. The weird thing is that - given that I've been running to

Maybe distinct

2019-11-16 Thread TinBryn
I was trying to implement something and ran into issues of combinatorial arguments. I trying using concepts to automate this process, but it didn't quite work out. Anyway here's some sample code to show what I mean. type Foo = concept f proc bar(baz: Foo, qux: Fo

Newbie question, ref object

2019-11-16 Thread JohnLuck
I am trying to send headers using the asynchttpserver module, this is what the documentation gives me sendHeaders(req: Request; headers: HttpHeaders) Run HttpHeaders documentation shows this: HttpHeaders = ref object table*: TableRef[string, se

Re: Use stdin with nim check

2019-11-16 Thread tmgo324
Understood. Do not use stdin. Should we also avoid specifying file paths like tmpfile? Using tmpfile gave different results. Therefore, I thought that it should not be used.

Re: Use stdin with nim check

2019-11-16 Thread tmgo324
Understood. Do not use stdin. Should we also avoid specifying file paths like tmpfile?

Re: Maybe distinct

2019-11-16 Thread mratsim
This should work: proc bar(baz, qux: distinct Foo) = Run

Re: Newbie question, ref object

2019-11-16 Thread drkameleon
Perhaps like this? sendHeaders(req, newHttpHeaders([("Content-Type","application/json")])) Run

Differences between simple assignment, shallowCopy and deepCopy

2019-11-16 Thread drkameleon
I've been doing several experiments on the matter and read a lot, but to make sure II got it right, I would be grateful if I had your input. So... What is the difference between: * a = b * shallowCopy(a,b) * deepCopy(a,b) when: * a/b are objects * a/b are ref objects * a/b are s

Re: Newbie question, ref object

2019-11-16 Thread JohnLuck
Yes, it worked! Thank you

Re: Differences between simple assignment, shallowCopy and deepCopy

2019-11-16 Thread Stefan_Salewski
I think for most of us it works exactly as we suppose. Some years ago there was no exact documentation available, so indeed you request writing documentation. But I think explaining this is not that easy, as it should be understandable to newcomers, but at the same time not boring for experts.

Re: Nim for enterprise software development

2019-11-16 Thread vonH
> So to get it running you have to write a layer in pascal which uses cdecl or > stdcall and exposes the whole VCL - for everything you want to access from > Nim. How easy is this? Can it be automated?

Re: Nimrad: Nim and Rapid Application Development

2019-11-16 Thread spip
> I prefer a nice DSL over a "RAD" any day. > > So I think DSL are the way to go on Nim. Seems to be a broad generalization inference of the rule "if I think that A, so B must be true for everybody"!:-) Like @Usor said, RAD development tools like Oracle Forms or 4GL have some advocates in comp

Re: Differences between simple assignment, shallowCopy and deepCopy

2019-11-16 Thread treeform
At first I was like, what a simple question... then I started to explain it I was like wha You can think of it as shallowCopy with some extra. * a/b are objects - shallowCopy of the struct including packed objects (which might appear like deepCopy). * a/b are ref objects - shallowCopy o

Re: Multi-method wrongly dispatches to base

2019-11-16 Thread konradmb
> Apart from that I really don't like to pull the "actually what you are asking > is not what you want" card, but this is not how you should write a lexer. I'd like to, but it's for a class assignment, so I have to do it by hand. Also, I want to learn how it can be done on lower level of abstrac

Re: ``Table.take`` should be ``Table.pop`` -- discuss

2019-11-16 Thread spip
As proc name overloading is one of the ways to offer genericity in Nim code, selecting the right name is important, particularly for data structures that share similar behaviours. Some languages have symbol renaming or aliasing, like Eiffel, to handle such cases of semantic similarity. +1 for p

Re: Nim based Github Actions

2019-11-16 Thread hiteshjasani
Great idea. Just added it.

Re: Nimrad: Nim and Rapid Application Development

2019-11-16 Thread juancarlospaco
`I != everybody` by definition. Still better than using Electron for everything. :P

Web applications and pattern match

2019-11-16 Thread edu500ac
In tutorials that the Della-Vos group publish, there is a rule that no example should go beyond one page. I tried to follow this rule in the tutorial about the Nim language. However, I am not entirely satisfied with the small web application described in chapter 7 of the tutorial, here: [https:

Re: Nimrad: Nim and Rapid Application Development

2019-11-16 Thread Usor
I didn't actually say it, though I see what you're getting at ;) Yes, and it's reasonable to think that, once these advocates smell Nim with RAD, if it's been established, they would smell * reduction in costs; * quick development; * great performance; * more productivity; * easier mai

Array vs tuple for procs returning multiple values of same type

2019-11-16 Thread Stefan_Salewski
When I started with Nim years ago I used arrays, as tuples are only necessary when not all types are identical, and as we can iterate at runtime over array, which may be rarely needed for a proc result. Then I saw examples using tuples, and I think that time automatic tuple unpacking was working

Re: Array vs tuple for procs returning multiple values of same type

2019-11-16 Thread kaushalmodi
I'd just use a tuple or object for that.

Re: the "type" of the curly-bracket structure

2019-11-16 Thread dom96
This curly bracket structure is called the "Table constructor": [https://nim-lang.org/docs/manual.html#statements-and-expressions-table-constructor](https://nim-lang.org/docs/manual.html#statements-and-expressions-table-constructor). You should be able use `varargs[(string, string)]` as the type

Re: Jester performance on FreeBSD is 1/10 of that on Linux

2019-11-16 Thread dom96
Cool, thanks for testing. I can't imagine what could cause this difference in httpbeast, perhaps Nim's kqueue implementation is significantly worse than its epoll implementation. Maybe Amazon's EC2 has worse performance on FreeBSD? Have you tried comparing other http servers?

the "type" of the curly-bracket structure

2019-11-16 Thread JohnAD
If I write a macro as such: macro `@@@`(x: typed): FancyType = # stuff goes here var a = @@@{"fromStruct": "blah", "sub": {"joe": 10}} Run All is good. Or if I do: macro `@@@`(x: Blork): FancyType = # stuff goes here let xyz

wNim TextCtrl + Scrollbar

2019-11-16 Thread onelivesleft
Does anyone have an example of a wNim TextCtrl with a scrollbar? I can make it appear, but it doesn't do anything. Also, if I paste a large text into the control then I can no longer type in it: it just sounds the bell.

Re: Differences between simple assignment, shallowCopy and deepCopy

2019-11-16 Thread mratsim
There are 2 semantics in Nim and low-level programming languages like C, C++, Rust. 1\. Value semantics. 2\. Reference semantics. Value semantics means that the copy owns its memory and lives separately from the copied. Reference semantics means that the copy and the copied refer to the same

Re: Cross Platform Python Package

2019-11-16 Thread sflennik
I've been looking for another approach. From what I've read, the python wheel package can do what I want, but it is still a mystery to me how. Has anyone done this and know of a project I can learn from? I haven't been able to find an example in the python or nim public package lists.

Re: Jester performance on FreeBSD is 1/10 of that on Linux

2019-11-16 Thread juancarlospaco
Wait, isnt BSD Hardened by default?.

Re: Nimdoc: example of nimscript

2019-11-16 Thread edu500ac
Hi, Kaushalmodi. I saw your answer only now. I will study the link you sent me carefully. Thank you for the attention.

Re: Nimdoc: example of nimscript

2019-11-16 Thread edu500ac
As for using lem instead of emacs, the problem is that we could not find an emacs mode that works flawlessly for nim. The students tried nimrod-mode and nim-mode: 1 -- nimrod-mode does not highlight multiline comments. 2 -- nim-mode often fail in performing indentation. For instance, in the li

Problems with Emacs mode for Nim

2019-11-16 Thread edu500ac
Students who are trying to learn Nim complain that Emacs modes for Nim do not work flawlessly, and are huge. These students tried nimrod-mode and nim-mode. Here are a small sample of the problems that they encountered: 1 -- nimrod-mode does not highlight multiline comments. 2 -- nim-mode often

Re: Problems with Emacs mode for Nim

2019-11-16 Thread edu500ac
By the way, I posted these comments about nimrod-mode and nim-mode because one often asks why Marcus and Luciano are using lem with their students.

wNim TextCtrl scrollbar

2019-11-16 Thread onelivesleft
How do you track the scroll position of a TextCtrl? When I try textctrl.getScrollPos() it won't compile, and attaching scroll events to the ctrl never fire.

Re: Jester performance on FreeBSD is 1/10 of that on Linux

2019-11-16 Thread Hideki
OK. nginx on FreeBSD has worse performance as well. It looks a performance problem in FreeBSD on EC2. nginx on FreeBSD $ wrk --latency -t 16 -c 1024 http://172.31.40.197/ Running 10s test @ http://172.31.40.197/ 16 threads and 1024 connections Thread Stats Avg

Re: Nim based Github Actions

2019-11-16 Thread treeform
Thanks this is just want I was looking for! The cache stuff is great and makes the builds fast.

Re: the "type" of the curly-bracket structure

2019-11-16 Thread JohnAD
As much as I wanted that to work, it doesn't. Once I place type like that in the macro parameter, the compiler re-encodes the Table Constructor as an array (nnkTableConstructor disappears from the NimNode). And then it stops supporting mixed structures like: `{"a": "blah", "b": 4}` Not a big d

Re: Problems with Emacs mode for Nim

2019-11-16 Thread Vindaar
You're right that there's a couple of examples where the indentation of nim-mode is all over the place and this is one of them. I've been meaning to take a look at this too, but lack of time and not being that experienced with elisp means I haven't done so. Something like this is another: