help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Adding missing bash features for safely re-usable bash c


From: John Kearney
Subject: Re: [Help-bash] Adding missing bash features for safely re-usable bash code
Date: Mon, 08 Apr 2013 22:11:27 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5

Am 08.04.2013 18:38, schrieb Pierre Gaston:

On Mon, Apr 8, 2013 at 6:19 PM, adrelanos <address@hidden> wrote:
Hi!

Asking the other way around...

Pierre Gaston:
> It may be difficult to write safely re-usable bash code

This doesn't look like something impossible to do, just like a missing
feature in bash.

That doesn't seem so simple to do to me.

What are the missing features in bash for writing easily, safely
re-usable bash code?
 
Without thinking too much about it what comes to my mind immediately:
 * bash has only one name space for functions, so it's easy to overwrite any function used in a module.
* There's only one name space for global variables 
* There's a gazillion of options (shopt and set) to globally modify bash behavior (including parsing)

I don't think it's comprehensive by any measure
 
Could bash be extended with these missing features?
 
Maybe but I thought the most interesting part of my email was where I said that I don't think it prevents someone from making such a repository now,
and that by starting now it can bring some good things such as some guidelines and coding style guides.

I will even go as far as reverting your point of view: starting such a repository might help to identify what new features would really help .

In many projects what is lacking are not the features and a big list of  "must have" but someone starting to do the actual work. (And no I don't volunteer)


If there is interest I could probably contribute a starting point, my first attempt is here but thats now deprecated.
https://github.com/dethrophes/Experimental-Bash-Module-System


In my second gen I tried to learn from the problems I had with the first gen, I added naming conventions and cleaned up the code syntax  I also removed most bash dependencies. I aim for pdksh/bash base.
This isn't actually posted anywhere public yet, But I've attached some of the module files for reference.


Name spacing is not something you need support if you have coding conventions. In fact it tends to cause more of a mess in a language like bash.




Attachment: ks_mod_array.sh
Description: Bourne shell script

Attachment: ks_mod_console.sh
Description: Bourne shell script

Attachment: ks_mod_genfuncs.sh
Description: Bourne shell script

Attachment: ks_mod_hash.sh
Description: Bourne shell script

Attachment: ks_mod_log.sh
Description: Bourne shell script

Attachment: ks_mod_Prompt.sh
Description: Bourne shell script

Attachment: ks_mod_StrFuncs.sh
Description: Bourne shell script

Attachment: ks_mod_svn.sh
Description: Bourne shell script

Attachment: ks_mod_Test.sh
Description: Bourne shell script

Attachment: ks_mod_usr.sh
Description: Bourne shell script

Attachment: ks_mod_Vt100.sh
Description: Bourne shell script

Attachment: ks_mod_xml.sh
Description: Bourne shell script


reply via email to

[Prev in Thread] Current Thread [Next in Thread]