You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Prefer stack manipulation over creating intermediate dictionaries
445
-
- Use immediate references directly in main procedures instead of creating local aliases (e.g., use `//encoder.fnc1` directly rather than `/fnc1 //encoder.fnc1 def`). This saves runtime dictionary lookups.
453
+
- Use immediate references directly instead of creating local aliases (e.g., use `//encoder.fnc1` directly rather than `/fnc1 //encoder.fnc1 def`). This saves runtime dictionary lookups.
446
454
- When latevars needs a helper function to compute values, define it in static scope (ensure to bind it; see `auspost.rsprod`) and reference via `//encoder.helper exec` in latevars to save lookups.
447
455
448
456
**Conditional Assignment Pattern**
@@ -498,6 +506,51 @@ Loops should be commented as such in the first line:
498
506
} loop
499
507
500
508
509
+
**Reading Global Context**
510
+
511
+
Read configuration from (optional) global context with a default:
512
+
513
+
```postscript
514
+
/configvalue 42 def % Default
515
+
/uk.co.terryburton.bwipp.global_ctx dup where {
516
+
exch get /configkey 2 copy known {get /configvalue exch def} {pop pop} ifelse
517
+
} {pop} ifelse
518
+
```
519
+
520
+
521
+
**Module-Level Caching with fifocache**
522
+
523
+
For expensive computations that benefit from caching across invocations (e.g.,
524
+
generation of Reed-Solomon polynomial coefficients), use the `fifocache`
525
+
resource:
526
+
527
+
```postscript
528
+
/encoder.coeffscachemax N def % Override with global_ctx.encoder.coeffscachemax
529
+
/encoder.coeffscachelimit M def % Override with global_ctx.encoder.coeffscachelimit
/dic 1 dict def % Initial size, should be sized appropriately; for static data, prefer next power of 2 above expected size
938
+
dic /a 1 put
939
+
dic /b 2 put % May overflow capacity, but is resized transparently (with associated performance impact)
940
+
```
941
+
942
+
It is not possible to dynamically grow an existing array:
943
+
944
+
```postscript
945
+
/arr 1 array def % Fixed size, should be sized appropriately
946
+
arr 0 /a put % Indexed at zero
947
+
arr 1 /b put % Error: Out of bounds write
948
+
arr 1 get % Error: Out of bounds read
949
+
```
950
+
951
+
821
952
Names and strings are treated as equivalent when compared:
822
953
823
954
```postscript
@@ -856,7 +987,7 @@ Some PLRM terminology is a source of confusion. As a result of the following com
856
987
```
857
988
858
989
-`a` is referred to as the "object" (within the currentdict)
859
-
- The `--array--` created by `]` is referred to as "the storage for the object in VM" (either global or local VM depending on the allocation mode indicated by `globalstatus`)
990
+
- The `--array--` created by `]` is referred to as "the storage for the object in VM" (either global or local VM depending on the allocation mode indicated by `currentglobal`)
860
991
-`b` is also an "object" that refers to the same VM storage as `a`
861
992
862
993
The terminology differs from many languages where the array itself would be referred to as an object and a and b would be referred to as names or references.
0 commit comments