NAV (CA/l) should use short-circuit evaluation
miOnKeyb
Member Posts: 13
Why in 2018 doesn't MS "upgrade" C/AL to use short-circuit evaluation?
IF Customer.GET('1000') and Customer."No."='1234' THEN Die();
I hate the 90's ....
IF Customer.GET('1000') and Customer."No."='1234' THEN Die();
I hate the 90's ....
0
Answers
-
Hi mionKeyb,
The above is a database operation. IMHO NAV has made it so easy to fetch data from database with relatively simple commands.
I don't get what you imply by
Customer.GET('1000') and Customer."No."='1234'
you mean customer who has No. 1000 and 1234 that doesn't make sense
0 -
Maybe because it's been like that since NAV was initially released, and is it possible that some code may rely on old expression evaluation? Not on only Microsoft's code base, it could well be in customizations / addons code too.Why in 2018 doesn't MS "upgrade" C/AL to use short-circuit evaluation?
Can you imagine the burden put on all partners by introducing such a fundamental change? It would require everybody to conduct detailed code review and analysis, and potentially rewrite and test changes.
Since you know that NAV does use short-circuit evaluation write your code in a way to avoid constructs where lack of it may cause potential problems.Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
As pointed out in Wikipedia, the short-circuit expression "x and y" is equivalent to
if x then y else false
The short-circuit expression "x or y" is equivalent to:if x then true else y
So you can write equivalent code if it's so important, although I acknowledge that its not as elegant.Alastair Farrugia0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 322 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
