Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Factorials were someone's attempt to make math LOOK exciting.


devel / comp.unix.shell / Tags for variables of Korn shell

SubjectAuthor
* Tags for variables of Korn shellSpiros Bousbouras
+- Re: Tags for variables of Korn shellBit Twister
`* Re: Tags for variables of Korn shellJanis Papanagnou
 `* Re: Tags for variables of Korn shellSpiros Bousbouras
  `* Re: Tags for variables of Korn shellJanis Papanagnou
   `- Re: Tags for variables of Korn shellJanis Papanagnou

1
Tags for variables of Korn shell

<DBaJ0YJuxSYaFC8In@bongo-ra.co>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5704&group=comp.unix.shell#5704

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: spi...@gmail.com (Spiros Bousbouras)
Newsgroups: comp.unix.shell
Subject: Tags for variables of Korn shell
Date: Thu, 8 Sep 2022 08:48:49 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <DBaJ0YJuxSYaFC8In@bongo-ra.co>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 8 Sep 2022 08:48:49 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="b62f46ac1ea126dfaabd9308ff1a1c6c";
logging-data="731773"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/nay9Te/9N3anVOOc+ThWi"
Cancel-Lock: sha1:maWH3ItzSO/16XvpEyOIjt2dURM=
X-Organisation: Weyland-Yutani
 by: Spiros Bousbouras - Thu, 8 Sep 2022 08:48 UTC

Looking in man ksh I see

typeset
[...]
-t Tags the variables. Tags are user definable and have no special
meaning to the shell.

Can someone give me any realistic examples of how this is
supposed to be used ?

Re: Tags for variables of Korn shell

<slrnthjgph.2118l.BitTwister@wb.home.test>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5705&group=comp.unix.shell#5705

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: BitTwis...@mouse-potato.com (Bit Twister)
Newsgroups: comp.unix.shell
Subject: Re: Tags for variables of Korn shell
Date: Thu, 8 Sep 2022 05:25:53 -0500
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <slrnthjgph.2118l.BitTwister@wb.home.test>
References: <DBaJ0YJuxSYaFC8In@bongo-ra.co>
Injection-Info: reader01.eternal-september.org; posting-host="b41994348a6a281d60c99577eddbd0c5";
logging-data="747465"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18zf32Vja/PZwR3g2/nDpqHCqimjUDdHO8="
User-Agent: slrn/pre1.0.4-6 (Linux)
Cancel-Lock: sha1:GDlvvlS/xN/CLNeKNY5jFjYutBE=
 by: Bit Twister - Thu, 8 Sep 2022 10:25 UTC

On Thu, 8 Sep 2022 08:48:49 -0000 (UTC), Spiros Bousbouras wrote:
> Looking in man ksh I see
>
> typeset
> [...]
> -t Tags the variables. Tags are user definable and have no special
> meaning to the shell.
>
> Can someone give me any realistic examples of how this is
> supposed to be used ?

Well putting
ksh typeset example
in the first box at
https://www.google.com/advanced_search
gets me
About 17,800 results (0.48 seconds)
hits.

I found the fist selection
typeset (Learning the Korn Shell, 2nd Edition)
pretty informative.

Re: Tags for variables of Korn shell

<tfcinq$n3fq$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5706&group=comp.unix.shell#5706

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: Tags for variables of Korn shell
Date: Thu, 8 Sep 2022 13:12:58 +0200
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <tfcinq$n3fq$1@dont-email.me>
References: <DBaJ0YJuxSYaFC8In@bongo-ra.co>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 8 Sep 2022 11:12:58 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="83576cd898b1eb10e45c9fda9acbe004";
logging-data="757242"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qGf5RPonqxXZycJ7ZJ2Kj"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:DeaBm7RtB3+51gk7cnm24nXHQsc=
In-Reply-To: <DBaJ0YJuxSYaFC8In@bongo-ra.co>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Thu, 8 Sep 2022 11:12 UTC

On 08.09.2022 10:48, Spiros Bousbouras wrote:
> Looking in man ksh I see
>
> typeset
> [...]
> -t Tags the variables. Tags are user definable and have no special
> meaning to the shell.
>
> Can someone give me any realistic examples of how this is
> supposed to be used ?

Since a tag has no special meaning to the shell and since the
shell is agnostic about variable semantics it's up to the user
to identify application cases.

Effectively you can interrogate all your "tagged variables" by
typeset [-+]t so that you could define a set of variables for
special treatment; to interrogate the names and actual values
of any tagged variables, e.g. for debugging purposes.

For such a tagging feature it might have been a better design
("better" = with wider application range) to enable the user
defining tag types, though, like typeset -t label var ...
typeset -t debug a b c
typeset -t log a e
typeset -t tmp_res c d
typeset -t log > logfile
But all those ideas are void given that some documentation
sources say "This option is obsolete."

Myself I've never used typeset -t in my ksh source code but
now that I've been pointed to that option I think there may
be useful applications (like the ones hinted above off the
top of my head or other).

Janis

Re: Tags for variables of Korn shell

<lNDzeqJtuti43785v@bongo-ra.co>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5708&group=comp.unix.shell#5708

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!aioe.org!wMjcvFyyQbKkD1DyxkS8fQ.user.46.165.242.91.POSTED!not-for-mail
From: spi...@gmail.com (Spiros Bousbouras)
Newsgroups: comp.unix.shell
Subject: Re: Tags for variables of Korn shell
Date: Thu, 8 Sep 2022 18:41:09 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <lNDzeqJtuti43785v@bongo-ra.co>
References: <DBaJ0YJuxSYaFC8In@bongo-ra.co> <tfcinq$n3fq$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="16642"; posting-host="wMjcvFyyQbKkD1DyxkS8fQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
X-Organisation: Weyland-Yutani
X-Server-Commands: nowebcancel
 by: Spiros Bousbouras - Thu, 8 Sep 2022 18:41 UTC

On Thu, 8 Sep 2022 13:12:58 +0200
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
> On 08.09.2022 10:48, Spiros Bousbouras wrote:
> > Looking in man ksh I see
> >
> > typeset
> > [...]
> > -t Tags the variables. Tags are user definable and have no special
> > meaning to the shell.
> >
> > Can someone give me any realistic examples of how this is
> > supposed to be used ?
>
> Since a tag has no special meaning to the shell and since the
> shell is agnostic about variable semantics it's up to the user
> to identify application cases.
>
> Effectively you can interrogate all your "tagged variables" by
> typeset [-+]t so that you could define a set of variables for
> special treatment; to interrogate the names and actual values
> of any tagged variables, e.g. for debugging purposes.

So you're saying that tagging is just a boolean thing i.e. either
a variable is tagged or not. If that's the case then it's even
less useful than I thought. If you want to print the values of
some variables for debugging , you just print the values , I don't
see that it buys you anything to tag them first.

> For such a tagging feature it might have been a better design
> ("better" = with wider application range) to enable the user
> defining tag types, though, like typeset -t label var ...
> typeset -t debug a b c
> typeset -t log a e
> typeset -t tmp_res c d
> typeset -t log > logfile

So you're thinking of the possibility of associating an arbitrary
tag with a variable. This is how I originally thought it works.
So for example you could tag that a numerical variable is inches
and another cm .But even that would not be much useful unless the
shell offered many more capabilities like taking into account tags
before performing some operations. And in any case , such tagging
would be perhaps appropriate for a large project and I don't think
that a shell is a good language for a large project , tagging or
no tagging.

> But all those ideas are void given that some documentation
> sources say "This option is obsolete."

My guess is that it won't be going away despite what the documentation
says.

> Myself I've never used typeset -t in my ksh source code but
> now that I've been pointed to that option I think there may
> be useful applications (like the ones hinted above off the
> top of my head or other).

--
Be bold , verb a noun today.

Re: Tags for variables of Korn shell

<tfdga9$q0bq$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5709&group=comp.unix.shell#5709

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: Tags for variables of Korn shell
Date: Thu, 8 Sep 2022 21:37:44 +0200
Organization: A noiseless patient Spider
Lines: 76
Message-ID: <tfdga9$q0bq$1@dont-email.me>
References: <DBaJ0YJuxSYaFC8In@bongo-ra.co> <tfcinq$n3fq$1@dont-email.me>
<lNDzeqJtuti43785v@bongo-ra.co>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 8 Sep 2022 19:37:45 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="7989931a0c3a1ec9df1783c0c8654e25";
logging-data="852346"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/GUXYdHOpyBYFfjdY82X9Z"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:pFP/IPVEggjGO069WctQxLW05Xc=
In-Reply-To: <lNDzeqJtuti43785v@bongo-ra.co>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Thu, 8 Sep 2022 19:37 UTC

On 08.09.2022 20:41, Spiros Bousbouras wrote:
> On Thu, 8 Sep 2022 13:12:58 +0200
> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
>> On 08.09.2022 10:48, Spiros Bousbouras wrote:
>>> [ ksh's typeset -t ]
>
> So you're saying that tagging is just a boolean thing i.e. either
> a variable is tagged or not.

Yes. It seems it's not more that that.

> If that's the case then it's even
> less useful than I thought. If you want to print the values of
> some variables for debugging , you just print the values , I don't
> see that it buys you anything to tag them first.

Not quite. My thought was along this (sample-)application...

typeset a ; ... ; typeset -t b c ; ... ; typeset d ; typeset -t e ;
.... ; printf "*** Debug: %s\n" $( typeset -t ) ; typeset +t e ; ...

In other words, define the tag attribute when the variable is set
(or declared) and print all tagged variables later in "one place",
optionally adjust tags as necessary in the course of the executed
program. I.e. it would be a mark declaring it as "var is interesting
for debugging, logging, as intermediate result, ... (whatever)" and
separating that declaration semantics from the execution point of
interest.

>> [ hypothetical labels as in typeset -t label var ... ]
>
> So you're thinking of the possibility of associating an arbitrary
> tag with a variable. This is how I originally thought it works.

Yes, this is what one would naturally assume when talking about
tags and tagging. But obviously it's just an untyped flag. (My
picture about the [assumed] implementation in the shell is that
the type information may be just a bit-field representing { r/o,
integer, float, ..., and 'tag' }; anything else would require a
more complex data structure.)

> So for example you could tag that a numerical variable is inches
> and another cm .But even that would not be much useful unless the
> shell offered many more capabilities like taking into account tags
> before performing some operations. And in any case , such tagging
> would be perhaps appropriate for a large project and I don't think
> that a shell is a good language for a large project , tagging or
> no tagging.

Well, as said, I think it could still be useful. Though not as
much as it could be, especially as rudimentary as it is provided.

For example, another application that I can think of being useful
would be to mark some variables as GDPR-relevant, then it could
be simply avoided to e.g. log or display values of such variables,
but that would require to have some inverse-logic flag available;
currently typeset -t will show the variables (a possible extension
could be to functionally differentiate between -t and +t, using
one of it to support that inverse logic). Such an inverse function
could be considered independently of adding <label> functionality,
the latter making the shell function change less trivial.

>
>> But all those ideas are void given that some documentation
>> sources say "This option is obsolete."
>
> My guess is that it won't be going away despite what the documentation
> says.

Most likely.

With "ksh 93u+m" there would be a path, though, to refine/replace
that typeset option with a more useful [extended] variant.

Janis

Re: Tags for variables of Korn shell

<tfdhvs$q58a$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5710&group=comp.unix.shell#5710

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: Tags for variables of Korn shell
Date: Thu, 8 Sep 2022 22:06:19 +0200
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <tfdhvs$q58a$1@dont-email.me>
References: <DBaJ0YJuxSYaFC8In@bongo-ra.co> <tfcinq$n3fq$1@dont-email.me>
<lNDzeqJtuti43785v@bongo-ra.co> <tfdga9$q0bq$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 8 Sep 2022 20:06:20 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="7989931a0c3a1ec9df1783c0c8654e25";
logging-data="857354"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1900H4LZ0idv7LeL/mNkq2L"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:8vQ75cpqx3HvMNjDM727xwtDvhw=
In-Reply-To: <tfdga9$q0bq$1@dont-email.me>
 by: Janis Papanagnou - Thu, 8 Sep 2022 20:06 UTC

On 08.09.2022 21:37, Janis Papanagnou wrote:
>
> Yes, this is what one would naturally assume when talking about
> tags and tagging. But obviously it's just an untyped flag. (My
> picture about the [assumed] implementation in the shell is that
> the type information may be just a bit-field representing { r/o,
> integer, float, ..., and 'tag' }; anything else would require a
> more complex data structure.)

I have to correct that picture; there's already arguments
available with certain typeset options that already need
some special handling (-Z3, -i8, etc.).

Janis

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor