#1 2020-01-28 08:01:28

erick
Member
Registered: 2015-09-09
Posts: 155

blocks limit of 32 arguments

When passing data to remote functions, you often have a lot of data to send.

With Mormot, the design decision was made to limit you to 32 parameters per remote function.  I can see that when memory is limited. 
But with modern 64 bit systems, I find this artificial limit is often frustrating.  Now I have to make 3 or 4 API calls per page to update
the data from one HTML web page to live within the 32 parameter limit.  I dread every time someone asks for another new field.

The size of 'blocks' is hard coded at 64 entries, would it break things if I were to double or more  that on 64 bit systems?    The code uses High( blocks ), so I'm hoping it would be able to handle any power of 2?

Thanks,
Erick

Offline

#2 2020-01-28 08:04:09

sakura
Member
From: Germany
Registered: 2018-02-21
Posts: 239
Website

Re: blocks limit of 32 arguments

Why not simply create one or more records to pass your data?  (just askin')

I can't really see a problem here. Clean Coding usually would limit you to about 3 parameters anyway and more than six is akin to code smell...

Offline

#3 2020-01-28 10:11:07

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,673
Website

Re: blocks limit of 32 arguments

I agree with sakura.
The maximum number of parameters has nothing to do with memory limitation, or even that the i386 CPU has 32-bit registers.
It is a matter of design. More than five/six parameters makes any interface difficult to understand and maintain.

Just check your own code.
Do any of your regular functions in your Delphi code take more than 32 parameters?
Do any of the RTL / VLC / LCL methods take more than 32 parameters?

So the idea is to regroup values into classes or records, which are names DTOs.
We have premium record support, which are great to create what those DTOs.
Even if you don't use all the records fields, your code will be much better.
And from the client point of view, having some nested JSON objects is much preferred to a huge set of properties.

I will clearly state the above in the documentation/source.

Offline

#4 2020-01-28 14:05:24

erick
Member
Registered: 2015-09-09
Posts: 155

Re: blocks limit of 32 arguments

Sure, nested JSON will solve my problem.   SOlutions right in front of my eyes. Thanks.

Erick

Offline

Board footer

Powered by FluxBB