In the Ivy Designer Guide, Chapter 7, section Null handling / Automatic object creation, it states

You can to use the .# operator to suppress the automatic object creation.

if( in.#customer == null)
{
  // object is null
}

if (in.#customer is initialized)
{
  // object is not null or has been set to a non-default value
}

I also discover that we can do a chain of suppresing initialization like this:

if (in.#bigDataClass.#smallerDataClass.#smallDataClass.#tinyDataClass.#fieldXyz is initialized) {
    // Reach here if all of the properties are initialized
} else  {
   // Reach here if any of the properties are null
}

This really reduces the verbosity of the code when I want to check a deep structure of data classes. Despite its usefulness, I cannot find any (Ivy) documentation mentioning about this feature. I only discovered it by chance and have been using it until now.

My question is whether this is an official feature but has been forgotten to mention or it is an unofficial/hidden feature and could be dropped in the future?

Thanks & Regards

asked 04.08.2014 at 11:35

Genzer%20Hawker's gravatar image

Genzer Hawker
(suspended)
accept rate: 66%


The .# operator works always also if chained. So that is an official feature. I will add another sample to the documentation which will show that.

link

answered 04.08.2014 at 15:59

Christian%20Strebel's gravatar image

Christian St... ♦
3.2k31338
accept rate: 88%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×33
×1

Asked: 04.08.2014 at 11:35

Seen: 2,534 times

Last updated: 04.08.2014 at 15:59