On 19 Jun 2002 20:09:54 -0500, Dave Trollope wrote:
> 
> At first I thought the idea of implementing alias' was very good but I
> fear that limiting it to the first word would be too limiting to be
> really useful. Take for example:
> 
> *FvwmButtonsGeometry 520x100-1-1
> *FvwmButtonsBack bisque3
> *FvwmButtons(Padding 2 2 Container(Rows 1 Columns 4 Frame 1 Padding 10 0))
>  *FvwmButtons(Frame -2 Container(Rows 5,Frame 1))
> 
> I would find it really useful to alias the above in to:
> 
> Alias FB *FvwmButtons
> FBGeometry 520x100-1-
> FBBack bisque
> FB(Padding 2 2 Container ...)
> FB(Frame -2 Container...)

Dave, in all your examples with no exception you either want functions or
preprocessing, both are already available. You don't need a new alias
functionality for this. Aliases only needed to be able to configure
hardcoded builtins that fvwm and modules have in the code, for other cases
there are other solutions.

> However this implies a more preprocessor like parsing than direct
> aliasing. To break the preprocessing approach we could take C style ##
> to join an alias with some text:
> 
> FB##Geometry 520x100-1-
> FB##Back bisque
> FB(...
> FB(...

Use:

  AddToFunc FB
  + I *FvwmButtons: $*

  FB Geometry 520x100-0-0
  FB (Padding 2 2, Container ...)

> Also, it would be really useful to do aliases with more than the first
> word - take:
> 
> AddToMenu Red_Hat_Linux "Programs" Title
> Style "*"           FocusFollowsMouse
> 
> It would be really useful to alias the first two args and make the
> config much more readable to new users:
> 
> Alias AddToLinux AddToMenu Red_Hat_Linux
> Alias DefStyle Style "*"
> AddToLinux "Programs" Title
> DefStyle           FocusFollowsMouse

Use:

  AddToFunc AddToLinux I AddToMenu Red_Hat_Linux $*
  AddToFunc DefStyle I Style * $*

  AddToLinux "Programs" Title
  DefStyle FocusFollowsMouse, OLDecor

> This kind of ability would be much more useful than straight aliases.
> 
> However, Alias' are typically a poor mans solution to other problems.
> For example, a better functionality would be to implement a "With XXX
> ...." functionality which would also constrain the impact to the area of
> the file instead of being applied globally:
> 
> With *FvwmButtons
>     Geometry 520x100-1-1
>     Back bisque3
>     (Padding 2 2 Container(Rows 1 Columns 4 Frame 1 Padding 10 0))
>     (Frame -2 Container(Rows 5,Frame 1))
> EndWith

FvwmButtons has such ability, create a file containing the lines above
and use *FvwmButtons: File myfb.fvwmrc
Or use functions, or preprocessors. For example, create this file:

sub With ($$) { foreach (split(/\n/, $_[1]) { command("*$_[0]: $_"); } }

With "FvwmButtons", '
        Geometry 520x100-1-1
        (Padding 2 2, Container(Rows 1, Columns 4, Frame 1, Padding 10 0))
';

With "FvwmPager", q{
        Geometry ...
};

Then put one line in your fvwm2rc: FvwmPerl --load mymodules.fpl
If you really want I may add something like this to FvwmPerl --preprocess
so you should not write a definition of With yourself.

> Perhaps there is a place for alias' but there are also other solutions
> to problems that Alias are often used to solve.  In general constructs
> that have global scope are misused. Perhaps constraining it to one word
> will prevent abuse and then implementing better solutions that people
> can use to solve different problems would be a good approach?

Here I can only agree.

> Another constraint could be to limit an alias to the file that it is
> defined in like static in C.

I don't think that a concept of aliases as Dominik defined it (replacing
builtins) has something to do with a file scope, it is a dynamic thing,
while files are static.

Regards,
Mikhael.
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [EMAIL PROTECTED]
To report problems, send mail to [EMAIL PROTECTED]

Reply via email to