Re: Parsing timestamps?

Liste des GroupesRevenir à cl forth 
Sujet : Re: Parsing timestamps?
De : the.beez.speaks (at) *nospam* gmail.com (Hans Bezemer)
Groupes : comp.lang.forth
Date : 11. Jun 2025, 10:41:07
Autres entêtes
Organisation : KPN B.V.
Message-ID : <nnd$23fdd7d8$6d8a6ce4@ee20d3e04c3c745a>
References : 1 2 3 4 5 6 7 8
User-Agent : Mozilla Thunderbird
On 10-06-2025 19:34, LIT wrote:
So now you see: one can either use variable to
make the solution cleaner - or one can create new word(s).
Either way - some new names are added to the vocabulary.
Why the use of variable, instead of new words,
should be perceived of 'inferior'? Variable is a word too.
>
Unlike variables, factors (subroutines) don't contradict effective
stack-based programming.
  From "Thinking Forth":
 "TIP: Simplify code by using the stack. But don’t stack too
deeply within any single definition. Redesign, or, as a last resort,
use a named variable.
 Some newcomers to Forth view the stack the way a gymnast views
a trampoline: as a fun place to bounce around on. But the stack
is meant for data-passing, not acrobatics.
 [..]
 (not going to paste (almost) whole chapter, but you may want
to read the section "Redesign" that follows the above)
 I’ve been guilty many times of playing hotshot, trying to do
as much as possible on the stack rather than define a local
variable. There are three reasons to avoid this cockiness.
 First, it’s a pain to code that way. Second, the result
is unreadable. Third, all your work becomes useless when
a design change becomes necessary, and the order of two
arguments changes on the stack. The DUPs, OVERs and ROTs
weren’t really solving the problem, just jockeying things
into position. With this third reason in mind, I recommend
the following:
 TIP: Especially in the design phase, keep on the stack only
the arguments you’re using immediately. Create local
variables for any others. (If necessary, eliminate the variables
during the optimization phase.)
 Fourth, if the definition is extremely time-critical, those
tricky stack manipulators, (e.g., ROT ROT) can really eat up
clock cycles. Direct access to variables is faster."
You're mixing quotes with your own statements - and frankly, I'm not gonna clean that mess up.
First of all, Brodie tries to cover as wide a field as possible - and as usual, there is an exception to every (heuristic) rule. So - yeah, I used the occasional variable as well. Like when keeping track of the position on a screen. I'm not going to drag that s*cker all over the data flow, just because Brodie said so.
It also doesn't work very well for arrays in general. You may pass an address to an array to a word, but you're not setting those up in the beginning to surf on the data flow throughout the program.
But you know very well that's not what I'm addressing..
You know you're fighting a losing battle when you go into a chapter called "The stylish stack" and seek for cherries to pick. That's not gonna work.
And although there is a very funny cartoon in that chapter, all you need to know is: "I have a friend who has the sign “Help stamp out variables” above his desk."
So if you want to find some straw to hold on to, you're not gonna find it here:
"TIP: Unless it involves cluttering up the stack to the point of unreadability, try to pass arguments via the stack rather than pulling them out of variables."
There is much for you to learn here. If your stack clutters up, it doesn't automatically mean it can't be done. It just means *you* can't do it. I've been humbled by these grumpy old men here numerous times - and I thank them for that, because it made me a better programmer.
 > Yes, Brodie warns us next "but careful with variables' use
 > too" - and I still think my use of variables in two examples
 > I recently pasted wasn't "legit" in any way. It was just
 > applying the tips you see above.
It wasn't legit, because I proved it could be done *without global variables.* And note every variable access takes two or three words. It's *not* automatically faster. If you think a programming language always behaves the same - in all situations, on all platforms, in every iteration - it's time for you to read "Advanced C" by the Andersons. Gee, you got a long way ahead of you!
Hans Bezemer

Date Sujet#  Auteur
6 Oct 24 * Parsing timestamps?77dxf
6 Oct 24 +* Re: Parsing timestamps?40mhx
6 Oct 24 i+* Re: Parsing timestamps?3dxf
6 Oct 24 ii`* Re: Parsing timestamps?2dxf
7 Oct 24 ii `- Re: Parsing timestamps?1dxf
7 Jun13:38 i`* Re: Parsing timestamps?36B. Pym
7 Jun15:36 i +* Re: Parsing timestamps?21dxf
7 Jun18:07 i i`* Re: Parsing timestamps?20LIT
8 Jun03:38 i i `* Re: Parsing timestamps?19dxf
9 Jun14:21 i i  `* Re: Parsing timestamps?18Hans Bezemer
9 Jun14:34 i i   `* Re: Parsing timestamps?17LIT
9 Jun20:31 i i    `* Re: Parsing timestamps?16Hans Bezemer
9 Jun21:00 i i     `* Re: Parsing timestamps?15LIT
10 Jun03:31 i i      +* Re: Parsing timestamps?4dxf
10 Jun08:32 i i      i+* Re: Parsing timestamps?2mhx
10 Jun09:30 i i      ii`- Re: Parsing timestamps?1dxf
10 Jun11:10 i i      i`- Re: Parsing timestamps?1LIT
10 Jun10:52 i i      +* Re: Parsing timestamps?2LIT
10 Jun14:12 i i      i`- Re: Parsing timestamps?1Hans Bezemer
10 Jun12:08 i i      +* Re: Parsing timestamps?2LIT
10 Jun13:56 i i      i`- Re: Parsing timestamps?1LIT
10 Jun13:07 i i      +* Re: Parsing timestamps?2Stephen Pelc
10 Jun15:06 i i      i`- Re: Parsing timestamps?1Anton Ertl
10 Jun13:48 i i      +* Re: Parsing timestamps?3LIT
10 Jun21:56 i i      i`* Re: Parsing timestamps?2LIT
11 Jun10:18 i i      i `- Re: Parsing timestamps?1Hans Bezemer
10 Jun15:56 i i      `- Re: Parsing timestamps?1Hans Bezemer
9 Jun13:34 i +- Re: Parsing timestamps?1B. Pym
10 Jun10:18 i `* Re: Parsing timestamps?13B. Pym
10 Jun11:32 i  +* Re: Parsing timestamps?11dxf
10 Jun11:43 i  i`* Re: Parsing timestamps?10LIT
10 Jun15:58 i  i `* Re: Parsing timestamps?9dxf
10 Jun16:39 i  i  +- Re: Parsing timestamps?1LIT
10 Jun18:34 i  i  `* Re: Parsing timestamps?7LIT
10 Jun18:39 i  i   +- Re: Parsing timestamps?1LIT
11 Jun02:49 i  i   +* Re: Parsing timestamps?4dxf
11 Jun10:04 i  i   i+* Re: Parsing timestamps?2LIT
11 Jun11:49 i  i   ii`- Re: Parsing timestamps?1dxf
11 Jun10:58 i  i   i`- Re: Parsing timestamps?1LIT
11 Jun10:41 i  i   `- Re: Parsing timestamps?1Hans Bezemer
11 Jun10:25 i  `- Re: Parsing timestamps?1B. Pym
6 Oct 24 +* Re: Parsing timestamps?5Ruvim
6 Oct 24 i`* Re: Parsing timestamps?4dxf
6 Oct 24 i `* Re: Parsing timestamps?3Ruvim
6 Oct 24 i  +- Re: Parsing timestamps?1Ruvim
6 Oct 24 i  `- Re: Parsing timestamps?1Ruvim
6 Oct 24 +* Re: Parsing timestamps?6FFmike
6 Oct 24 i`* Re: Parsing timestamps?5FFmike
7 Oct 24 i `* Re: Parsing timestamps?4dxf
7 Oct 24 i  `* Re: Parsing timestamps?3FFmike
7 Oct 24 i   `* Re: Parsing timestamps?2dxf
7 Oct 24 i    `- Re: Parsing timestamps?1FFmike
6 Oct 24 +* Re: Parsing timestamps?2Anthony Howe
7 Oct 24 i`- Re: Parsing timestamps?1dxf
7 Oct 24 +* Re: Parsing timestamps?9albert
7 Oct 24 i`* Re: Parsing timestamps?8dxf
7 Oct 24 i `* Re: Parsing timestamps?7sjack
8 Oct 24 i  `* Re: Parsing timestamps?6dxf
8 Oct 24 i   +* Re: Parsing timestamps?3Ahmed
8 Oct 24 i   i+- Re: Parsing timestamps?1dxf
8 Oct 24 i   i`- Re: Parsing timestamps?1sjack
8 Oct 24 i   `* Re: Parsing timestamps?2sjack
9 Oct 24 i    `- Re: Parsing timestamps?1dxf
8 Oct 24 +* Re: Parsing timestamps?3albert
8 Oct 24 i`* Re: Parsing timestamps?2dxf
8 Oct 24 i `- Re: Parsing timestamps?1Ahmed
9 Oct 24 +* Re: Parsing timestamps?4alaa
10 Oct 24 i+* Re: Parsing timestamps?2dxf
10 Oct 24 ii`- Re: Parsing timestamps?1alaa
16 Oct 24 i`- Re: Parsing timestamps?1Hans Bezemer
18 Oct 24 `* Re: Parsing timestamps?7Gerry Jackson
19 Oct 24  `* Re: Parsing timestamps?6dxf
28 Oct 24   `* Re: Parsing timestamps?5Hans Bezemer
29 Oct 24    `* Re: Parsing timestamps?4dxf
29 Oct 24     `* Re: Parsing timestamps?3Hans Bezemer
30 Oct 24      `* Re: Parsing timestamps?2dxf
31 Oct 24       `- Re: Parsing timestamps?1dxf

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal