DynamoDS / DynamoWishlist

This is a repository for all wishlist items for Dynamo Core
https://github.com/orgs/DynamoDS/projects/3
Apache License 2.0
15 stars 3 forks source link

Concatenate null to string #26

Open anasazmi571 opened 6 years ago

anasazmi571 commented 6 years ago

If this issue is with Dynamo for Revit, please post your issue on the Dynamo for Revit Issues page.

If this issue is not a bug report or improvement request, please check the Dynamo forum, and start a thread there to discuss your issue.

Dynamo version

2.0

Operating system

Windows 10

What did you do?

I concatenated an object into a string. Example:

testObj = null;
testStr = "testObj: " + testObj + "\n";
return = testStr;

What did you expect to see?

The output to be as follows:

testStr: null

What did you see instead?

Just a null in the output.

mjkkirschner commented 6 years ago

This one seems straightforward, a null primitive object's toString returns "null"... seems you could just replace null with "" in the final string.

anasazmi571 commented 6 years ago

I feel this is more of a convenience issue. When debugging code block functions (as they don't produce any error message for null reference exceptions), I use string concatenation to see the contents of a variable to see if it's properly set, and having to add null checks every time I call the toString of a variable whose contents I don't know is null or not is cumbersome. Having the toString return either null or an empty string for null variables, or some sort of error message for null variables or invalid function calls (with a line number) would be helpful.