17
This idea is similar to this feature in C# : https://docs.microsoft.com/fr-fr/dotnet/csharp/programming-guide/types/boxing-and-unboxing


Especially when working with Record, Variant and RecordRef, but also with Codeunits/Interface, we have to constantly "cast" variables before calling a procedure and cast again when the value is returned.

Could you simplify developers lives by doing these operations automatically?


procedure DoSomething()
var
Customer: Record Customer;
Item: Record Item;
MyVar: Variant;
MyRec: RecordRef;
begin

//Currently:
MyRec.GetTable(Item);
MyVar := Customer
DoSomethingWithParams(MyVar, MyRec);
Customer := MyVar;
MyRec.SetTable(Item);

//With auto-boxing / unboxing
DoSomethingWithParams(Customer, Item);
//--> of course, here, if DoSomethingWithParams assigns something else than a Record Customer to the first argument or a record from another table for the second argument, an error should occured.
end;

procedure DoSomethingWithParams(var MyVar: Variant; var MyRec: RecordRef)
begin
//...
end;
Category: Development
STATUS DETAILS
Needs Votes
Ideas Administrator

Thank you for this suggestion! Currently this is not on our roadmap. We are tracking this idea and if it gathers more votes and comments we will consider it in the future.

Best regards,
Business Central Team