Dfinity SDK common compilation errors and fixes

Hi everyone. I just wanted to share this video with some common compilation errors and fixes I discovered while working with the SDK. Hopefully this will help save some of you some time when working with the SDK.

Feel free to post your own common compilation errors and fixes in the comments below as well. Thanks.

3 Likes

Also I just wanted to tag @alexa.smith. In the video I point out some odd behavior I found with the delimitation/non-delimitation of code with the semi-colon and I didn’t see anything in the docs about this. It would be good if the SDK team could take a look at it.

1 Like

very helpful video, thanks! the semicolon thing is indeed a little bit confusion, the documentation isn’t consistent about it either, sometimes the last line in a block has one, sometimes it doesn’t. but maybe i’m just missing something and there actually is a difference :grin:

It feels a bit odd doesn’t it, but while the docs aren’t consistent its usage is—you can omit the semicolon on any final statement or block (so before a closing }), including function and actor blocks themselves. It’s there to separate statements.

You can actually think of it as requiring a semicolon ‘before’ you write another statement.

1 Like

You’re right @Ori, the docs are consistent with this semi-colon style. I guess I was just curious about the compiler design decision.

1 Like

It did throw me too, great video btw!

1 Like

Nice video @Comp_Sci .
Upon digging deeper on the block syntax, what I’ve found is that these expressions closely follow those of the Rust language. The Rust Lang documentation does a nice job of explaining the minute details. This can be pretty useful for newbie programmers and those having very little exposure to existing languages like Rust.
Hopefully the documentation is revised to include details such as this.

2 Likes

Thanks for the tip @magpie_lover.

2 Likes