![]() |
#1 |
Участник
|
Navigate Into Success: Tip: Text constants in AL
Источник: https://vjeko.com/2020/10/09/tip-text-constants-in-al/
============== Long time no see, but that’s how it gets every now and then, I guess… Anyway, I am still alive, still kicking, just don’t get to blog as much as I’d hope for, it’s work, and life and universe and everything. So, I am back with not a typical “Vjeko” post, just a simple AL opinion piece. A tip, without a trick. One of the problems we’ve all suffered from in the old days of C/AL (who remembers that still, anyway) was inability to define real text constants. One thing we all avoided was using hardcoded Text literals, like this: ![]() ![]() There were no constants, and it sucked. Yeah, yeah, there *were* TextConst constants, but that’s not it. The moment you did this: ![]() ![]() Back in those pre-historic days, I’ve seen people work around this problem like this: ![]() Fast forward back to present. I’ve got myself in the middle of refactoring a chunk of code migrated from C/AL to AL a while ago. It’s full of “pluggable” things that identify themselves to various discoverers, and it’s full of “constants” coded with this function-that-returns-a-hardcoded-literal pattern. While this worked miracles in C/AL, in AL we actually have a far better way to handle this. Labels. Yeah, fells like I am discovering hot water or sliced bread or something, but please, for the record, don’t do this: ![]() ![]() Here endeth the lesson. No rocket science, just an easy one to document my train of thoughts for posterity. Everyone is entitled to my opinion, after all ![]() Read this post at its original location at https://vjeko.com/2020/10/09/tip-text-constants-in-al/, or visit the original blog at https://vjeko.com. 5e33c5f6cb90c441bd1f23d5b9eeca34The post Tip: Text constants in AL appeared first on Vjeko.com. Источник: https://vjeko.com/2020/10/09/tip-text-constants-in-al/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|