alguidelines icon indicating copy to clipboard operation
alguidelines copied to clipboard

WITH Scope Name Collision

Open Ji-Peter opened this issue 3 years ago • 3 comments

Since with either implicit or explicit are being deprecated, shouldn't this recommend not using with at all?

Ji-Peter avatar Jun 22 '22 20:06 Ji-Peter

Are there pages recommending use of with?

I found this archive one: https://alguidelines.dev/docs/navpatterns/3-cal-coding-guidelines/readability/nested-withs/

JeremyVyska avatar Jun 29 '22 07:06 JeremyVyska

There are some rules that would throw an error in the future:

Use of implicit 'with' will be removed in the future. Qualify with '{0}': https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/diagnostics/diagnostic-al604

The 'with' statement is deprecated and will be removed for cloud development in a future release: https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/diagnostics/diagnostic-al606

So, yes - would be recommended to not use them any longer and to convert, see: https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-deprecating-with-statements-overview

With Business Central 2022 release wave 2, the AL:Go! template for creating new AL projects in Visual Studio Code, now enables explicit with statements by default, by adding the NoImplicitWith option to the features property in the generated app.json file.

christianbraeunlich avatar Jan 03 '23 16:01 christianbraeunlich