Default input of Object is new object instead of null

The leads to change checks and cache regions always detecting change, and a lot of GC spam.

Any way to set this to null? Was that always the case? This currently blocks the development of a VL package that relies on flexible input types on some nodes.

Tested on 7.0 and 7.1 preview-176.

2 Likes

Ended up forwarding System.Object and setting the default, but that appears to be super dangerous as it could change the behavior of any patch that references this library…


Fully agree, it’s one of those very unfortunate oversights we carry with us from the start. Default of NULL with some sort of minimal support in front-end avoiding the immediate null pointer when placing the node would be optimal.

In the mean time - creating such a forward is a big NO. Things will break apart for sure. Some alternatives:

  • Use Optional<Object>
  • If stemming from C# you should be able to write (object someParam = null) - the system recognizes the null default here
1 Like

Good

Good ideas, both are good enough in this case, thanks!