9-Mar-00 23:52 you wrote:
Khimenko Victor wrote:
What about introducing a second `New' that allows the user to pass an additional parameter to the allocator?
Might be a solution. (Not that the syntax of `New' isn't already complicated enough... :-/)
Hmm. IMO something like p:=new[shm_alloc,pool1](string,100); should be recognizeable enough and should not disturb existing mess there much. Even if it's look more like LaTeX then C++ :-)
I do not like this syntax too much. (For Pascal. It's okay for LaTeX.;-) In principle, it should not be too hard to implement
New (allocator_function, other_parameters)
but with the current implementation of `New' it would need some nontrivial work in the parser.
Oh, no. Non-trivial work in parser is Ok. Non-trivial work in human reader's mind is NOT Ok. We have enough write-only languages like perl or C++ already...
A clean solution would be a re-write of the parser to accept about any command-line for `New' and then do the analysis afterwards.
The only real problem with this approach would be the implicit `with' in `New' when a constructor of an object is called.
Much more (to me at least) problem here is that to understood such code you must know what's this shm_alloc mean (is it type or pointer to function or wahtever?). Compiler will know this for sure, human reader not always...