is there any default type of generic type [T]

2021-10-02 Thread ftsf
I don't entirely understand your question, but default(T) Run exists. You can create a seq of a specific type with `newSeq[T]()`

is there any default type of generic type [T]

2021-10-02 Thread puruneko
when argument of function has any generic type or some types, can those types have default type? I have trouble that when empty sequence is set on argument of function with sequence having generic type, like following proc f[T](a: seq[T]) = discard f(@[])

Nim 1.6.0 RC2

2021-10-02 Thread ynfle
` $ criticality_score --repo github.com/nim-lang/Nim name: Nim url: https://github.com/nim-lang/Nim language: Nim created_since: 162 updated_since: 0 contributor_count: 739 org_count: 1 commit_frequency: 35.3 recent_releases_count: 3 updated_issues_count: 824 closed_issues_count: 551 comment_fr

Nim 1.6.0 RC2

2021-10-02 Thread elcritch
Nice! Signing infrastructure seems to be a pain afaict. Google just announced an "[Secure Open Source](https://security.googleblog.com/2021/10/introducing-secure-open-source-pilot.html)" project. One effort they're funding is setting up signing infra for open source projects. There's some metr

Nim's types related questions

2021-10-02 Thread Araq
> Does Nim have something for this? Yes, you can use a closure or a `RootRef` (which is a `ref` so you get automatic memory management).

Nim's types related questions

2021-10-02 Thread nya
Hello. In C I can use void pointer to store any pointer to some data. It can be helpful when type is unknown because it related to external source (something can use my library but replaces some functions to own and wants store own's object inside of my object). Does Nim have something for this

Design choice advice for Python-to-Nim transpiler (Python Devs)

2021-10-02 Thread Yardanico
This is actually used in the Nim stdlib as a way to implement interface-like objects -

Design choice advice for Python-to-Nim transpiler (Python Devs)

2021-10-02 Thread solo989
You could do something like this type Foo = object addTwoImpl : proc(a : Foo, x : int): int proc addTwo(a : Foo, x : int): int = a.addTwoImpl(a,x) proc `addTwo=`(a : var Foo, b : proc (a : Foo, x : int) : int) = a.addTwoImpl = b

Design choice advice for Python-to-Nim transpiler (Python Devs)

2021-10-02 Thread Recruit_main707
thats not entirely right either, because you need to pass an instance of the type too

Design choice advice for Python-to-Nim transpiler (Python Devs)

2021-10-02 Thread abdulhaq
So I picked the worst example lol that will teach me 🙂 and I learned something about nim too. Ah well I guess time will tell then.

Design choice advice for Python-to-Nim transpiler (Python Devs)

2021-10-02 Thread jyapayne
This can be done in Nim as well, but you'd just have to translate the default for `add_two`: type Foo = object addTwo: proc(x: int): int var foo = Foo() foo.addTwo = proc(x: int): int = x + 2 assert foo.addTwo(2) == 4 var bar = Foo() b

Nim 1.6.0 RC2

2021-10-02 Thread jyapayne
Apparently, this company provides free signing for open source projects: Maybe it's worth a contact?

Nim 1.6.0 RC2

2021-10-02 Thread auxym
Pretty sure we all are! The people who aren't is corporate/university IT. Good news for the signed binaries!

Nim 1.6.0 RC2

2021-10-02 Thread Araq
> I don't care about signing the binaries that I make myself, but I do care > that the Nim compiler and toolchain themselves aren't flagged as malicious. I > had a friend who was put off from learning Nim because of Windows Defender > complaining about it. Even if getting it signed isn't the be-