Jump to content
IGNORED

Temporary Variables, John Wayne, and Keanu f**king reeves


Retrospect

Recommended Posts

Bring popcorn and a comfortable chair.

 

Returning to the real question: There are no temporary variables in a subprogram. There are local variables, but they are stationary. Thus they can have the same name as variables outside the subprogram, or in another subprogram, without being the same variable. But they are not temporary, so if you set a local variable to something during one call of the subprogram, that value remains on the next call. Hence a subprogram can keep track of how many times it has been called.
Extended BASIC doesn't have any global variables. Thus it's impossible to access any outside variable from the inside of a subprogram, unless it's sent as a parameter.

There are formal parameters in the declaration of the subprogram. When called, the call statement contains the actual parameters, which are referred to by the names of the formal parameters inside the subprogram.

Normal (a simple variable, not an array or string) actual parameters are passed by reference, so if you change the formal parameter, it actually refers to the actual parameter. Thus a change of the formal parameter inside the subprogram will change the actual parameter (they are the same), so you can see the new value from outside the subprogram after the call.

If you call a subprogram which specifies a formal parameter but supply an expression as the actual parameter, then a change of the formal parameter inside the subprogram doesn't change the value of the actual parameter (the expression). In this case the parameter is passed by value, not by reference.

If you want to pass a simple actual variable by value, you can use this fact by enclosing it in parenthesis. Thus you make it a "fake expression", which results in changes to the parameter not being returned to the caller.

 

This is similar to how Fortran works. Which in turn is logical, since BASIC was created with the ambition to simplify Fortran.

Languages that instead belong to the Algol family tree, like Pascal, have a different concept. There all local variables are allocated for a procedure when it's called and discarded when the procedure exits. These local variables are really temporary, as they cease to exist when you exit the procedure. This also allows for a procedure to call itself, as the local variable set will be allocated once again on the new call. Recursive subprogram calls aren't possible in Extended BASIC, since there is only one fixed set of the local variables.

Parameters are defined to be by reference or by value at the declaration of the procedure, not at the call.

Pascal is also different in the way that all variables declared at one level are accessible from the next level of subroutines, but not vice versa. The only way to not being able to access a variable at an outer level is to declare a local one with the same name. Then the local will be used.

Fortran provides the COMMON command, which can make variables global.

Edited by apersson850
  • Like 8
Link to comment
Share on other sites

So far no one has shown me the location in memory for INT(2.7*7)+X so if you look you can find variable X and what is there, but where is the INT(2.7*7) stored?

Again this is the TEMPORARY VARIABLE the 2.7 is a 8 byte Floating Point number and 7 is a 8 byte Floating Point number.

2.7 x 7 must be performed somewhere then later added to X variable.

(Clue they are pushed onto the STACK and POPPED off later)

Hence TEMPORARY VARIABLES!

Link to comment
Share on other sites

This all started when I explained that Temporary variables exist in XB and some made the declaration that they do not exist.

I asked for the Source code in XB GPL or Assembly to show I am wrong, I got nothing in response but more speculation of opinion no code or proof.

I asked to explain how INT(2.7*7)+X done and where this is stored, I got nothing showing the code or how it works but more opinion.

My last post explains exactly how it works and where it is stored, and I can provide the Source Code too!

Link to comment
Share on other sites

1 hour ago, RXB said:

So far no one has shown me the location in memory for INT(2.7*7)+X so if you look you can find variable X and what is there, but where is the INT(2.7*7) stored?

Again this is the TEMPORARY VARIABLE the 2.7 is a 8 byte Floating Point number and 7 is a 8 byte Floating Point number.

2.7 x 7 must be performed somewhere then later added to X variable.

(Clue they are pushed onto the STACK and POPPED off later)

Hence TEMPORARY VARIABLES!

Yes, they are temporary values used by the interpreter to calculate expressions. Such things happen all the time when formulas are parsed and then computed. But they are not temporary variables specifically associated with SUBprograms. A temporary variable in a subprogram is a variable you declare, see and use, but vanishes as soon as the SUBprogram exits. Such things doesn't exist in Extended BASIC.

These temporary values are created regardless of whether you call a subprogram or not. It's a different thing.

Now I understand what you mean, but the expression temporary variables have a well established and defined meaning, and this is not it.

Another thing is dynamic variables, which are explicitly created by the program on the run, and then discarded, often before the program ends. Unlike normal variables, the total number and memory requirements for dynamic variables isn't known when the program is written. It usually depends on the data you get. They don't exist in BASIC either, but they do in Pascal, for example.

  • Like 2
Link to comment
Share on other sites

1 hour ago, RXB said:

This all started when I explained that Temporary variables exist in XB and some made the declaration that they do not exist.

From the quote at the start of this thread it looks like you stated that they were a special thing in SUBprograms. Which they are not. Temporary values exist everywhere, but temporary variables are something else.

Link to comment
Share on other sites

5 minutes ago, TheBF said:

McClintock with John Wayne?

 

One of my favourite lines. (Irish ancestry helps me identify)

"McLintock" indeed.  One of his best, IMNSHO.  A Westernized re-telling of "Taming of the Shrew," and a really damned good cast to boot.  There is a lot of wit and wisdom packed into this film.

  • Like 1
Link to comment
Share on other sites

As for John Wayne he was a hero when i was a kid, but after I heard more of these facts about him that changed to distaste.

When he was making a movie with a Oscar winning Black actor that was the COOK on the Chuckwagon he was standing on the

opposite side of Chuckwagon getting drink when he heard John Wayne talking to the Director and Wayne said 

"When we are not filming keep the nigger off the set"

And a similar thing happened to other Black Actors that worked with John Wayne.

Read the 1971 Playboy interview if you want a good idea of what kind of person he was in real life.

It is not acceptable to be a racist or a homophobe or sexist to women, it does not make you a hero but a bully.

  • Like 3
Link to comment
Share on other sites

1 hour ago, apersson850 said:

From the quote at the start of this thread it looks like you stated that they were a special thing in SUBprograms. Which they are not. Temporary values exist everywhere, but temporary variables are something else.

Show me your proof of how this works in the XB GPL and ROM Assembly code please?

I am curious how you know so many intimate details of XB internal structure without a single line of code for how it works?

Link to comment
Share on other sites

17 minutes ago, RXB said:

It is not acceptable to be a racist or a homophobe or sexist to women, it does not make you a hero but a bully.

Maureen O'Hara, John Ford, and Sammy Davis, Jr., have all said those rumors were pure bullshit.  I was not there, so I cannot judge for that, but I can judge the products he made and separate the message from the man (why I can still honor the legacy of Cliff Huxtable and the educational values of "Picture Pages" and "Fat Albert and the Cosby Kids" while detesting the actions of William Henry Cosby, Jr.)

  • Like 1
Link to comment
Share on other sites

30 minutes ago, RXB said:

It is not acceptable to be a racist or a homophobe or sexist to women, it does not make you a hero but a bully.

Now this is where I can partake.  I might not know much about assembly or temporary variables that might not even BE temporary but virtue signaling off the back of something that might not even be true, I will partake in so much as to say, it might be bullshit, Rich.  I would hope it is.  My own grandfather loved John Wayne , watched all his movies.  And he hated racism and bullying.  

Seems these days anyone can be brought down by an article in a magazine or online, and just because it's written down, people automatically believe it to be true.  Could even have been a damn witch-hunt against the man.  

Link to comment
Share on other sites

@RXB  if we can read one article in Playboy and believe it to be true then we should also read the counter - article written by Wayne's son.

https://uk.news.yahoo.com/john-wayne-not-racist-son-name-statue-airport-080100069.html

 

And, should anyone not actually bother to click this, and continue to blindly believe John Wayne to be a racist just 'cus a few people said he was, (including Rich, which, sorry Rich but I checked your facebook lately and you seem to like calling out people to be racists, quite a lot ... racism IS bad, we all know this .. but you seem pre-occupied in calling out folks , sooooo ......

 

Let me make one thing clear — John Wayne was not a racist. I know that term is casually tossed around these days, but I take it very seriously. I also understand how we got to this point.

There is no question that the words spoken by John Wayne in an interview 50 years ago have caused pain and anger. They pained him as well, as he realized his true feelings were wrongly conveyed. The truth is, as we have seen in papers from his archives, he did not support “white supremacy” in any way and believed that responsible people should gain power without the use of violence. Those who knew him, knew he judged everyone as an individual and believed everyone deserved an equal opportunity. He called out bigotry when he saw it. He hired and worked with people of all races, creeds and sexual orientations.

John Wayne stood for the very best for all of us — a society that doesn't discriminate against anyone seeking the American dream. It would be an injustice to judge him based on a single interview, as opposed to the full picture of who he was. The current focus on social justice is absolutely valid and necessary. But attempts by some to use it for political advantage distract from real opportunities for reform.

One thing we know — if John Wayne were here today, he would be in the forefront demanding fairness and justice for all people. He would have pulled those officers off of George Floyd, because that was the right thing to do. He would stand for everyone’s right to protest and work toward change.

Since his death more than 40 years ago, his legacy continues through the John Wayne Cancer Foundation, which has helped provide courage, strength and grit to the fight against cancer, and through his extensive film library. My father believed that we can learn from yesterday, but not by erasing the past. His name, no matter where it is, will always embody these values, and our family knows the positive impact that he made on the world will never be diminished.

Link to comment
Share on other sites

What the hell is going on? @RXB you are a genius and @senior_falcon you are a genius, if you two idiots would get together there would be the definitive version of Extended Basic for the TI ever invented, EVER! 

 

  How this got on to John Wayne and whatever..wow.   @Retrospectdude, your games you make, in such a short time in between is nothing except amazing, You rock, Sir.  Thats all I have to say.  Peace. 

Edited by DavidC
spelled idiots wrong
  • Like 4
  • Haha 1
Link to comment
Share on other sites

41 minutes ago, DavidC said:

@Retrospectdude, your games you make, in such a short time in between is nothing except amazing, You rock, Sir.  Thats all I have to say.  Peace. 

Thankyou for your kind words.  I've been advised to slow down due to real-life issues, but there's another little game in the making :) 

  • Like 3
Link to comment
Share on other sites

On 3/9/2023 at 12:48 PM, RXB said:

 I require proof of YOUR OPINION.

Lastly any SUB programs use TEMPORARY variables thus will trigger a garbage collection more often than normal variables as they are not TEMPORARY.

Also if a Garbage Collection is executed that X, Y and Z$ will have to be recalculated again on next call of SUB TEST(X,Y,Z$)

 

Link to comment
Share on other sites

I use subs almost exclusively. Firstly they are named, which makes it much easier to understand program flow. Call test is better than gosub 100. Subs can be relocated without having to make changes to the calling statement, unlike regular subroutines where the calling gosubs have to modified to reflect the new line number. Lastly, particularly for larger subs, you can use local variables without affecting the main program ones even if they have the same name. And you can pass values to subroutines directly. For example, I frequently use a random number generating routine, and all I have to do is pass it the desired boundary numbers and it returns the appropriate random number. If you were to use a standard subroutine, then you would have to assign the boundary numbers to variables before doing a gosub. Another favorite sub of mine is a delay routine when I simply pass the desired number of iterations for the delay loop like CALL DELAY(50).

To be honest, there is really little benefit to using standard subroutines at all... 

  • Like 3
Link to comment
Share on other sites

2 hours ago, senior_falcon said:

 

If you call the Variables in that routine you have to use the same SUB TEST(X,Y,Z$) or you can only get those values when inside that SUB.

If you call it again to get a value you will see in TRACE it was again calculated just like last time SUB TEST(X,Y,Z$) was called.

This is not that hard to figure out just using XB TRACE COMMAND!

 

And RXB has the source code for COMPCT (Garbage Collection) in Source code that is same one as in normal XB ROMs.

COMPCT does not always move stuff unless it runs out of space or you specifically flag it to do so.

 

  1971 6DC0 0289  STKCHK CI   R9,STND12         Enough room on the subr stack?
       6DC2 83AE  
  1972 6DC4 1B18         JH   BSO               No, memory full error   
  1973 6DC6 C020         MOV  @VSPTR,R0         Get the value stack pointer   
       6DC8 836E  
  1974 6DCA 0220         AI   R0,48             Buffer-zone of 48 bytes   
       6DCC 0030  
  1975 6DCE 8800         C    R0,@STREND        Room between stack & strings  
       6DD0 831A  
  1976 6DD2 1A0E         JL   STKRTN            Yes, return   
  1977 6DD4 05C9         INCT R9                Get space on subr stack   
  1978 6DD6 CE4B         MOV  R11,*R9+          Save return address   
  1979 6DD8 CE42         MOV  R2,*R9+           Save COMMON function code   
  1980 6DDA C640         MOV  R0,*R9            Save v-stack pointer+48   
  1981 6DDC 06A0         BL   @COMPCT           Do a garbage collection   
       6DDE 73D8  
  1982 6DE0 8819         C    *R9,@STREND       Enough space now?   
       6DE2 831A  
  1983 6DE4 1406         JHE  BMF               No, MEMORY FULL error   
  1984 6DE6 0649         DECT R9                Decrement stack pointer   
  1985 6DE8 C099         MOV  *R9,R2            Restore COMMON function code  
  1986 6DEA 0649         DECT R9                Decrement stack pointer   
  1987 6DEC C2D9  RETRN  MOV *R9,R11            Restore return address  
  1988 6DEE 0649         DECT R9                Decrement stack pointer   
  1989 6DF0 045B  STKRTN RT   
  1990 6DF2 0460  BMF    B    @VPSH23           * MEMORY FULL   
       6DF4 6C1A  
  1991 6DF6 0460  BSO    B    @ERRSO            * STACK OVERFLOW  
       6DF8 6468  

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...