Difference between revisions of "Talk:SCM Instruction"
(→Format of value reading code: new section) |
|||
Line 8: | Line 8: | ||
::: We should somehow connect this page with [[SCM language]] (which is ''one'' of the languages that compile into SCM). [[User:Seemann|Seemann]] ([[User talk:Seemann|talk]]) 17:22, 19 August 2020 (UTC) | ::: We should somehow connect this page with [[SCM language]] (which is ''one'' of the languages that compile into SCM). [[User:Seemann|Seemann]] ([[User talk:Seemann|talk]]) 17:22, 19 August 2020 (UTC) | ||
:::: I think that if [[SCM language]] doesn't already link to this page somewhere, it should, but otherwise I think we should make sure it's obvious that there is a difference between the compiled SCM files and the languages that compile into them. My issue with [[SCM language]] is that it covers both the R* syntax ''and'' some details about compiled files, which I think ought to be kept separate. Whatever happens, I think this page should be independent (i.e. not part of a larger page). – [[User:Squ1dd13|Squ1dd13]] ([[User talk:Squ1dd13|talk]]) 17:56, 19 August 2020 (UTC) | :::: I think that if [[SCM language]] doesn't already link to this page somewhere, it should, but otherwise I think we should make sure it's obvious that there is a difference between the compiled SCM files and the languages that compile into them. My issue with [[SCM language]] is that it covers both the R* syntax ''and'' some details about compiled files, which I think ought to be kept separate. Whatever happens, I think this page should be independent (i.e. not part of a larger page). – [[User:Squ1dd13|Squ1dd13]] ([[User talk:Squ1dd13|talk]]) 17:56, 19 August 2020 (UTC) | ||
+ | |||
+ | == Format of value reading code == | ||
+ | |||
+ | I notice that my [https://gtamods.com/mediawiki/index.php?title=SCM_Instruction&oldid=18794 edit] was reverted with the following reason: | ||
+ | |||
+ | <code> | ||
+ | Reminder: this is not a personal wiki and be careful to not get rid of valid information (original terminology does matter too). | ||
+ | </code> | ||
+ | |||
+ | I'm willing to accept that I may have done something wrong, but I'm unsure as to what that was. My aim was to convert the code for reading | ||
+ | argument values from almost plain C/C++ to something more abstract. It seems to me that code such as | ||
+ | |||
+ | <syntaxhighlight> | ||
+ | value = SignExtend32(ReadInt16(Bytecode, PC)) | ||
+ | PC += 2 | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | is rather too implementation-specific and is also unnecessarily terse: | ||
+ | |||
+ | 1. Does <code>SignExtend32</code> help demonstrate the structure? | ||
+ | : It appears to be an implementation detail that doesn't really help illustrate how someone might read the value from code. In many programming languages, this function call could be replaced with a cast or even nothing at all. | ||
+ | 2. Does <code>PC</code> need to be <code>PC</code> rather than something equivalent but more accessible, such as <code>programCounter</code>? | ||
+ | : It looks like this code has been taken from a larger codebase (although that's just a guess), so I can see why <code>PC</code> would be favoured there over something longer, since the variable would be used so much. However these are two or three line snippets, so I don't think there's a need to keep things short, especially when a longer name would be clearer. Sure, most readers are likely to know that <code>PC</code> would stand for "program counter", but why make things harder for the odd person who doesn't know that? | ||
+ | 3. Is <code>value</code> the right name for variable offsets? | ||
+ | : I get that the offsets are technically values, but when the description given is <i>Global integer/floating-point variable</i>, I think it would be possible for someone to interpret the variable name <code>value</code> as meaning "the value of the global integer/floating-point variable" rather than "the offset at which the value of the global integer/floating-point variable can be found". It is for this reason that I changed the name for the variable offsets. | ||
+ | |||
+ | I don't actually know what it was that caused my edit to be reverted, but I've written out these three points in case it was any of those. | ||
+ | |||
+ | I object to the suggestion that I'm treating this website as "a personal wiki": I'm just trying to help improve the article. I don't see how making edits amounts to treating this as my personal site. | ||
+ | |||
+ | As for "be careful to not get rid of valid information" and the suggestion that I changed terminology: I'm not sure what these comments are about. I was under the impression that I had simply changed the format of the information and only removed things that were not about the instruction format, such as <code>SignExtend32</code>. There may have been something I missed though, so I apologise if I removed something useful. | ||
+ | |||
+ | I'm only spending time writing this so I can better understand what I'm doing wrong here. Don't worry; I won't do this every time an edit gets reverted – only when I'm confused about the reasoning. I'm still quite new here, but I hope to keep contributing, so I want to learn how to go about that in the most constructive way possible. | ||
+ | |||
+ | – [[User:Squ1dd13|Squ1dd13]] ([[User talk:Squ1dd13|talk]]) 19:34, 19 March 2021 (UTC) |
Revision as of 19:34, 19 March 2021
Article name
The name "opcode" does not seem fitting for a page that describes the actual SCM instruction format. While the introduction suggests that the page is about the opcode alone ("Each script instruction is represented by a number called opcode"), the rest simply describes the format of instructions along with their arguments. As such, I propose that either the page's title is changed to something like "Instruction" or "Script Instruction", or that another page be created for the non-opcode information (which seems silly, given how little there is to say about the opcode itself).
– Squ1dd13 (talk) 15:38, 17 August 2020 (UTC)
- Agreed that this article covers more than opcodes. Not sure what name would fit there. It should be a clear distiction between instructions in 3D and HD eras. Maybe SCM Instruction. Seemann (talk) 05:35, 19 August 2020 (UTC)
SCM Instruction sounds like a good name. Should we rename the page then? I don't actually know how to do that.– Squ1dd13 (talk) 11:05, 19 August 2020 (UTC)- Cheers. I've changed the introduction so that it fits with the new title, so you might just wanna check if it's ok. – Squ1dd13 (talk) 17:10, 19 August 2020 (UTC)
- We should somehow connect this page with SCM language (which is one of the languages that compile into SCM). Seemann (talk) 17:22, 19 August 2020 (UTC)
- I think that if SCM language doesn't already link to this page somewhere, it should, but otherwise I think we should make sure it's obvious that there is a difference between the compiled SCM files and the languages that compile into them. My issue with SCM language is that it covers both the R* syntax and some details about compiled files, which I think ought to be kept separate. Whatever happens, I think this page should be independent (i.e. not part of a larger page). – Squ1dd13 (talk) 17:56, 19 August 2020 (UTC)
- Agreed that this article covers more than opcodes. Not sure what name would fit there. It should be a clear distiction between instructions in 3D and HD eras. Maybe SCM Instruction. Seemann (talk) 05:35, 19 August 2020 (UTC)
Format of value reading code
I notice that my edit was reverted with the following reason:
Reminder: this is not a personal wiki and be careful to not get rid of valid information (original terminology does matter too).
I'm willing to accept that I may have done something wrong, but I'm unsure as to what that was. My aim was to convert the code for reading argument values from almost plain C/C++ to something more abstract. It seems to me that code such as
value = SignExtend32(ReadInt16(Bytecode, PC))
PC += 2
is rather too implementation-specific and is also unnecessarily terse:
1. Does SignExtend32
help demonstrate the structure?
- It appears to be an implementation detail that doesn't really help illustrate how someone might read the value from code. In many programming languages, this function call could be replaced with a cast or even nothing at all.
2. Does PC
need to be PC
rather than something equivalent but more accessible, such as programCounter
?
- It looks like this code has been taken from a larger codebase (although that's just a guess), so I can see why
PC
would be favoured there over something longer, since the variable would be used so much. However these are two or three line snippets, so I don't think there's a need to keep things short, especially when a longer name would be clearer. Sure, most readers are likely to know thatPC
would stand for "program counter", but why make things harder for the odd person who doesn't know that?
3. Is value
the right name for variable offsets?
- I get that the offsets are technically values, but when the description given is Global integer/floating-point variable, I think it would be possible for someone to interpret the variable name
value
as meaning "the value of the global integer/floating-point variable" rather than "the offset at which the value of the global integer/floating-point variable can be found". It is for this reason that I changed the name for the variable offsets.
I don't actually know what it was that caused my edit to be reverted, but I've written out these three points in case it was any of those.
I object to the suggestion that I'm treating this website as "a personal wiki": I'm just trying to help improve the article. I don't see how making edits amounts to treating this as my personal site.
As for "be careful to not get rid of valid information" and the suggestion that I changed terminology: I'm not sure what these comments are about. I was under the impression that I had simply changed the format of the information and only removed things that were not about the instruction format, such as SignExtend32
. There may have been something I missed though, so I apologise if I removed something useful.
I'm only spending time writing this so I can better understand what I'm doing wrong here. Don't worry; I won't do this every time an edit gets reverted – only when I'm confused about the reasoning. I'm still quite new here, but I hope to keep contributing, so I want to learn how to go about that in the most constructive way possible.