Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^5: the disadvantages of mini-languages

by BrentDax (Hermit)
on Feb 05, 2005 at 21:02 UTC ( [id://428376]=note: print w/replies, xml ) Need Help??

in reply to Re^4: the disadvantages of mini-languages
in thread the disadvantages of mini-languages

True, but shell is a really nasty backing language. It isn't very well integrated with make, and ultimately it suffers from the same flaw as make--it was designed as a limited tool, in this case for linking programs together, and doesn't give you access to a more powerful language (unless, of course, you use a Perl one-liner or something).

--Brent Dax
There is no sig.

  • Comment on Re^5: the disadvantages of mini-languages

Replies are listed 'Best First'.
Re^6: the disadvantages of mini-languages
by Aristotle (Chancellor) on Feb 06, 2005 at 11:14 UTC

    (unless, of course, you use a Perl one-liner or something)

    Q.E.D.? :-)

    Did I mention I find make extraordinarily useful for many tasks besides building compiled software? Almost the only time I will rewrite Perl scripts is to translate them to Makefiles.

    Makeshifts last the longest.

      Almost the only time I will rewrite Perl scripts is to translate them to Makefiles.

      Ok, you've piqued my interest. Would you mind providing a simple example, either in this thread (as an example of a mini-language in action) or in another thread?

      Being right, does not endow the right to be rude; politeness costs nothing.
      Being unknowing, is not the same as being stupid.
      Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
      Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

        Any long chain of transformations depending on each other is a good candidate. F.ex I have been meaning to write a makefile for web galleries, ie a task where you take a large bunch of pictures and generate thumbnails and a batch of index pages — but only when a thumbnail doesn't already exist or only when there's new pictures to add to an index page, so that you can toss a few more pictures into the heap and regenerate the gallery without waiting an eternity for everything to be regenerated. Doing all the necessary checks in Perl to achieve that kind of statefulness is easy, but the code turns out messy. For make, this job is just natural.

        A simply example would be my corefonts makefile. It was originally a nasty shell script. The makefile looks like a mouthful, but most of it amounts to “constants,” and the real code is just a few lines at the bottom and all the rest happens automagically and it won't redownlad or reextract files you already have.

        Note that all of this works better the more self-contained the parts of your toolchain are. The recipe for each rule shouldn't be more than 2 or 3 lines for the majority of cases and should only rarely need to be more than even one. Then you just tell make how to assemble the machinery and it makes everything happen for you. Get to understand the tool well and it's just amazing.

        Makeshifts last the longest.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://428376]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-05-21 23:14 GMT
Find Nodes?
    Voting Booth?

    No recent polls found