Too Many Segdef (Compiler Error)

nettalk
compiler
Tags: #<Tag:0x00007f46e487f8e8> #<Tag:0x00007f46e487f7a8>

#1

The “Too Many Segdef” compiler error has plagued my life for a few years now.

In the most layman of terms (because that’s how my brain works) it means: You have a procedure somewhere that has way too many lines of code, template or otherwise.

Specifically for me, it’s because I’ve been working with Nettalk and creating some very large forms.

So this post is related mostly to Nettalk (NetWebForms in particular). Am not sure how much it will hold with regular clarion (desktop) apps.

There are a couple of bits of wisdom I’ve gleaned (through others helpfulness!) that would be good to document so others can hopefully be helped.

PROCESS

1. If you get this error, go to your *.clw files and find the *.clw file causing the issue (sort by size is a good start). I keep all my clw files in their own folder, so it’s easier in that way, but whatever the case of your development environment, you need to find the clw. It’ll be one that’s pretty large.

2. Once you have the clw, you can work out the procedure that is causing the issue. Now when it happens, I’ve got a pretty good idea which one it was (it’ll be the form I just added something to, one of a couple of netwebforms that are sitting right at the edge of “too many segdef”).

3. Once you have the troublemaking form in your sights, you have a couple of choices.

CHOICE #1: Try and minimise the template code in the form.

With NetWebForms (Nettalk), there are a couple of things that can be done. You can, if you have a form where this won’t interfere, turn off all comments for the form. This will significantly reduce the amount of template code in the form. But you lose comments (full stop, no way around it except to hack Bruce’s beautiful template code).

You can also look at removing any redundant fields, perhaps merging fields whose functionality might be duplicated elsewhere in the form.

CHOICE #2: Rip the form to bits (with pen and paper first usually!) and rebuild it with multiple interfaces.

If you have a form that’s hitting the “too many segdef” error, then you have a big form.

You want to look at breaking it up regardless. Having lots of tabs/sections, scrolling for miles, none of that is ideal when you could swap out for half a dozen buttons that launch popup forms instead.

In my experience I’ve usually taken both of those options.

Here’s a screenshot of the once-too-many-segdef “Person” netwebform, now broken up into multiple interfaces with what I call “popup buttons” (urg).

Hope this helps.