Calling same-named-function from abstruct object

2020-09-28 Thread Araq
> Does it pose a potential security risk by means of code injection? Depends on what you mean by "security". IMO not it doesn't, because you can always call the wrong function and produce a bug. But it depends on your definition of "security". For example, for my definition of security: An OS t

VS Code Nim Extension in Nim

2020-09-28 Thread JPLRouge
Hello, the structure displays are missing

Define and call static proc of an object

2020-09-28 Thread chaemon
I want to define a static function of an object. I came up the way to use generics like the following. '''nim proc f(a:int, b:int):int = a + b type S[F:static[proc(a:int, b:int):int]] = object discard var s = S[f](https://forum.nim-lang.org/postActivity.xml) #echo s.F(3, 4) # cannot call l

Calling same-named-function from abstruct object

2020-09-28 Thread chaemon
Thanks! I understand completely. I have some kind of similar trouble and I will ask them other threads!

Calling same-named-function from abstruct object

2020-09-28 Thread slonik_az
Very interesting. It means that mixins are violating lexical scoping rules, for one does not know at definition what procedure `pow` symbol will be bound to at instantiation. Does it pose a potential security risk by means of code injection?

Is there a concept like "equality of refs" in Nim?

2020-09-28 Thread sschwarzer
See also .

Update on --gc:arc

2020-09-28 Thread Araq
Please read for more information.

Update on --gc:arc

2020-09-28 Thread cdunn2001
I'm confused. On the one hand, "Offers a shared heap." But on the other hand, "Well you cannot share them, you can move them around." If there is a shared heap, why can't we share?

Is there a concept like "equality of refs" in Nim?

2020-09-28 Thread shirleyquirk
you'd've thought but no. i guess i didn't make things simpler :/

Is there a concept like "equality of refs" in Nim?

2020-09-28 Thread mratsim
@shirleyquirk, you are creating the same ref. See type MyRef = ref object v: int let a = MyRef(v: 10) let b = MyRef(v: 10) echo a == b # false Run

Is there a concept like "equality of refs" in Nim?

2020-09-28 Thread shirleyquirk
to clarify, (i hope): `==` compares values. let a = 99 #99 is in some slot in memory (a.addr) let b = 99 #99 is in another slot in memory (b.addr) a == b # true, the value in slot a is the same as the value in slot b Run `==` compares values even for refs

Is there a concept like "equality of refs" in Nim?

2020-09-28 Thread jiyinyiyong
`==` would be a lot safer. In this special scenario, I do want to compare references since I was trying to implement structural sharing and comparing references is definitely faster than traversing the tree.