Skip to content

Commit 7f486fc

Browse files
committed
Slight update to opcodes considered "Internal".
Include some text about Internal & Deprecated ops. reformat a bit so it's clear what the primary opcode is. pmurias++ jnthn++
1 parent 41f97f0 commit 7f486fc

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed

docs/ops.markdown

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ VM-specific opcodes are denoted with a `jvm`, e.g. on the same line
4646
as the header. No annotation indicates this opcode should be supported on
4747
all nqp backends.
4848

49+
Some individual opcodes may be marked with _Internal_ or _Deprecated_.
50+
Both of these indicate the opcodes are not intended to be used. Deprecated
51+
opcodes will eventually be removed from NQP. Internal opcodes are typically
52+
used at compile time to replace opcodes that take a variable number of
53+
arguments.
54+
4955
# Arithmetic Opcodes
5056

5157
## abs
@@ -490,11 +496,9 @@ Return the position in `$haystack` at which `$needle` appears, or -1
490496
if `$needle` does not appear. Begin searching at position `$pos` if specified,
491497
or at 0, otherwise.
492498

493-
## indexfrom
494-
* `indexfrom(str $haystack, str $needle, int $pos)`
499+
* `indexfrom(str $haystack, str $needle, int $pos)` _Internal_
495500

496-
Return the position in `$haystack` at which `$needle` appears, or -1
497-
if `$needle` does not appear. Begin searching at position `$pos`.
501+
`index` is converted to this internal opcode by the compiler.
498502

499503
## iscclass
500504
* `iscclass(int $class, str $str, int $i)`
@@ -520,15 +524,10 @@ Return lowercase copy of string.
520524
Return the unicode codepoint of the first character in `$str`, or
521525
at the `$i`th character, if it's specified.
522526

523-
## ordat
524-
* `ordat(str $str, int $i)`
525-
526-
Return the unicode codepoint of the `$i`th character in `$str`
527+
* `ordat(str $str, int $i)` _Internal_
528+
* `ordfirst(str $str)` _Internal_
527529

528-
## ordfirst
529-
* `ordfirst(str $str, int $i)`
530-
531-
Return the unicode codepoint of the th character in `$str`
530+
`ord` is converted to these internal opcodes by the compiler.
532531

533532
## radix
534533
* `radix(int $radix, String $str, int $pos, int $flags)`
@@ -565,17 +564,10 @@ Searching backwards through the `$haystack`, return the position at which
565564
`$needle` appears, or -1 if it does not. Begin searching at `$pos` if
566565
specified, otherwise start from the last position.
567566

568-
## rindexfrom
569-
* `rindexfrom(str $haystack, str $needle, int $pos)`
570-
571-
Searching backwards through the `$haystack`, starting at `$pos` return the
572-
position at which `$needle` appears, or -1 if it does not.
567+
* `rindexfrom(str $haystack, str $needle, int $pos)` _Internal_
568+
* `rindexfromend(str $haystack, str $needle)` _Internal_
573569

574-
## rindexfromend
575-
* `rindexfromend(str $haystack, str $needle)`
576-
577-
Searching backwards through the `$haystack`, return the position at which
578-
`$needle` appears, or -1 if it does not.
570+
`rindex` is converted to these internal opcodes by the compiler.
579571

580572
## uc
581573
* `uc(str $str)`
@@ -592,15 +584,19 @@ If the original string begins or ends with the delimiter, the resulting
592584
array will begin or end with an empty element.
593585

594586
## substr
595-
* `substr(...)`
596-
* `substr2(str $str, int $position)`
597-
* `substr3(str $str, int $position, int $length)`
587+
* `substr(str $str, int $position)`
588+
* `substr(str $str, int $position, int $length)`
598589

599590
Return the portion of the string starting at the given position.
600591
If `$length` is specified, only return that many characters. The
601592
numbered variants required the args specified - the unnumbered
602593
version may use either signature.
603594

595+
* `substr2(str $str, int $position)` _Internal_
596+
* `substr3(str $str, int $position, int $length)` _Internal_
597+
598+
`substr` is converted to these internal opcodes by the compiler.
599+
604600
## tc
605601
* `tc(str $str)`
606602

@@ -875,12 +871,14 @@ specified environment variables. Returns a POSIX-style return value. Command
875871
is executed using an OS-appropriate shell (`sh -c` or `cmd /c`). Blocks
876872
until command is complete.
877873

878-
## shell
879-
* `shell(str $cmd)`
874+
* `shell(str $cmd)` _Deprecated: use the three argument version_
880875

881876
Same as the three argument version of `shell`, using the current directory and an empty environment.
882877

883-
_Deprecated: use the three argument version_
878+
* `shell1(str $cmd)` _Internal, Deprecated_
879+
* `shell3(str $cmd, str $path, %env)` _Internal_
880+
881+
`shell` is converted to these internal opcodes by the compiler.
884882

885883
## spawn
886884
* `spawn(@cmd, str $path, %env)`

0 commit comments

Comments
 (0)