Check out our Twitter:
[https://twitter.com/nim_lang](https://twitter.com/nim_lang)
(NT)
You are right, i forgot to add the type casting. The less verbose version is to
define a base proc and put there any common code for toolMethod:
type
A = ref object of RootRef
i: int
B = ref object of A
c: char
proc baseTest(a: A) =
a.i = 1
@Araq
1. Thank you.
2. You're right. My aging eyes did not see the ':'.
3. See the Tutorial:
[https://nim-lang.org/docs/tut1.html#basic-types](https://nim-lang.org/docs/tut1.html#basic-types)
. 'String' is among them.
@Araq I think my example didn't clearly show that the issue was that the
decision to close the server socket happens "independently" from the code that
accepts incoming connections. I've now move the "close code" in the same proc
as the "open code" (as you suggested), and use regular polling on
In your snippet you don't have to split up this in 2 different procs. And even
if you do, you can pass `server` as a parameter.
> And, more generally, does that mean I still need to use shared-heap to pass
> messages/signals across async tasks?
I think you can also use (async) queues instead.
Useful trick
1\. open main module doc:
[https://nim-lang.org/docs/system.html](https://nim-lang.org/docs/system.html)
2\. Do "group by type"
3\. Find cstring type
You will learn most of the stuff cstring can do
Thanks for the responses guys.
Araq: Thanks. Sorry, I had proc in my example but I meant method. I basically
want to have a common set of methods that can be shared among my child types
and want to know some good ways to achieve this in nim.
Ar: Thanks for the suggestion. That works alt
Welcome to nim-land. Go and Rust are common stops for new users as far as I
read.
You can use [procCall](https://nim-lang.org/docs/system.html#procCall,untyped):
procCall toolMethod(gun, 5)
Bear in mind nim is not as OOP friendly as other popular languages such as
Java/C#. Here you are not expected to use inheritance for everything.
By the way:
[https://g
var myPendingRequests {.threadvar.}: HashSet[ptr MsgBase]
myPendingRequests.init()
The compiler made you write this, it disallows `var myPendingRequests
{.threadvar.} = initSet[ptr MsgBase]()`. Ever wondered why? Because it would
only run for the main thread. I improved its error m
> If the error goes away, then that will "prove" the HashSet (and presumably
> every other complex threadvar object) needs to be initialised explicitly in
> each thread. If that is the case, it would be nice to have some syntax
> (something like the opposite of "static:") that takes care of that
Use `method` instead of `proc`? Not sure I understand your question.
1.
[https://github.com/nim-lang/nim/issues](https://github.com/nim-lang/nim/issues)
2. No, it doesn't, it shows the correct syntax `-d:release`.
3. Fair enough, but I doubt `string` is a "basic type".
When you use SSL, you need to specify this parameter when compiling:
nim c -d:SSL xx.nim
My version is 9.6. ui.set_theme() is the good function for me (and not
set_theme()), so it seems "ui" is also a buffer. The concept of buffer remains
mysterious for me, but Textadept is usable now.
16 matches
Mail list logo