![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Could the macro be split into two or take an extra flag to optionally not generate the definition for the globals? I'd be glad to give this a shot, but I wanted to hear from the community if there is any reason other than lack of volunteers. This has come up before; I found mailing list articles as far back as 2001 on this. |
#2
| |||
| |||
|
|
1. It generates code you can read. (It doesn't _have to_, I know, but it will be a design requirement.) 2. It generates code you can debug. Ever gotten compiler errors on the final line of an SSQLS declaration, because of an error in the expanded macro? I have. These messages are almost completely useless. And heaven help you should try single-stepping into an SSQLS method call. 3. It gives us the opportunity to trade C macro punctuationitis (trailing backslashes, token pasting syntax...) for a better syntax. I don't expect the boilerplate code to ever be as readable as pure C++ code, but it can be more readable than it is now. 4. The generated macro concept forces you into generating too much code. custom.pl generates macros for up to N-member SSQLSes, even if you never use all the {1..N-1} instances. The library maintainer's incentive is to make N large, so the end user never has to increase N, even though most programs will never have SSQLSes approaching N members. Complier limits and good sense, on the other hand, argue for lower values of N. The closest you can come to a happy medium is when the minimum number of compilers and bits of end-user code break when upgrading the library. 5. Last but not least, it solves the static member problem naturally. |
|
My only objection to it is that it requires special setup in the build environment, or a separate by-hand step for those environments that don't allow you to set up special build rules. To get those advantages, I can live with this. |
#3
| |||
| |||
|
|
If the syntax is all that bugs you, we could make the generator accept the current SSQLS macro syntax. It's pretty straightforward. The main reasons not to are that it rules out several classes of tools (e.g. XSLT) and it makes the parser more complex than it has to be. |
|
A middle ground would be to write a translator from the SSQLS syntax to the new one. |
|
I'm uncomfortable going in the other direction toward code generators, even with the above advantages. If those advantages aren't sufficient, what would it take? |
![]() |
| Thread Tools | |
| Display Modes | |
| |