Skip to content

Commit

Permalink
cursor: fix #traceForContext: for new return behavior
Browse files Browse the repository at this point in the history
So, still complements 679276e.
  • Loading branch information
LinqLover committed Jan 2, 2024
1 parent 22f0828 commit bf4dea0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ stream := cursor returnValueFor: someContext ifPresent: #yourself. "a ReadStream
(cursor object: stream atTime: (cursor maxTimeIndexFor: root)) position. "3"
(cursor object: stream atTime: (cursor maxTimeIndexFor: someContext)) next. "$\"

cursor object: stream collect: #position. "a TDBMemorySlice(*(0 to: 28) -> nil (29 to: 55) -> 0 (56 to: 174) -> 1 (175 to: 299) -> 2 (300 to: 2339) -> 3)*)"
cursor object: stream collect: #position. "a TDBMemorySlice(*(0 to: 28) -> nil (29 to: 55) -> 0 (56 to: 174) -> 1 (175 to: 299) -> 2 (300 to: 2338) -> 3)*)"
cursor memory object: stream atTimes: ((cursor minTimeIndexFor: someContext) to: (cursor maxTimeIndexFor: someContext)) collect: #position. "a TDBMemorySlice(*(18 to: 28) -> nil (29 to: 36) -> 0)*)"
cursor object: stream collect: [:ea | [(ea originalContents first: ea position) copy] on: Error do: #yourself]. "a TDBMemorySlice((0 to: 23) -> MessageNotUnderstood: UndefinedObject>>first: (24 to: 28) -> MessageNotUnderstood: UndefinedObject>>- (29 to: 55) -> '' (56 to: 174) -> '\' (175 to: 299) -> '\w' (300 to: 2339) -> '\w+')"
cursor object: stream collect: [:ea | [(ea originalContents first: ea position) copy] on: Error do: #yourself]. "a TDBMemorySlice((0 to: 23) -> MessageNotUnderstood: UndefinedObject>>first: (24 to: 28) -> MessageNotUnderstood: UndefinedObject>>- (29 to: 55) -> '' (56 to: 174) -> '\' (175 to: 299) -> '\w' (300 to: 2338) -> '\w+')"
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ instance creation
traceForContext: aContext

^ (self forContext: aContext)
doStepUntil: [false];
doStepUntil: [:ctxt |
aContext isDead or:
[(ctxt tdbIdentical: aContext) and:
[aContext sender isNil and: [aContext willReturn]]]];
timeIndex: 0;
yourself
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"class" : {
"coroutines" : "ct 3/14/2022 00:22",
"exampleScriptingAPIs" : "ct 12/28/2022 01:04",
"exampleScriptingAPIs" : "ct 1/2/2024 21:14",
"exampleStepping" : "ct 7/31/2022 00:43",
"examples" : "ct 3/16/2022 17:08",
"forContext:" : "ct 12/1/2021 00:44",
Expand All @@ -13,7 +13,7 @@
"rangeRetracingGC" : "ct 7/24/2022 15:43",
"traceClass" : "ct 11/18/2021 18:06",
"traceForBlock:" : "ct 5/14/2022 16:26",
"traceForContext:" : "ct 5/14/2022 16:14" },
"traceForContext:" : "ct 1/2/2024 21:15" },
"instance" : {
"allContextClassesBelow:" : "ct 3/21/2022 18:55",
"allContextHomeSignaturesBelow:" : "ct 3/21/2022 18:55",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ Note that all side effects during a proxy access will be isolated, so for instan
For more details, refer to the comment in TDBProxy. If you ever need to escape from proxy hell, send aProxy copy tdbproxyYourself. See flag #proxyHacks.
Accessing historic ranges (like the history explorer does)
cursor object: stream collect: #position. "a TDBMemorySlice(... (0 to: 28) -> nil (29 to: 55) -> 0 (56 to: 174) -> 1 (175 to: 299) -> 2 (300 to: 2339) -> 3) ...)"
cursor object: stream collect: #position. "a TDBMemorySlice(... (0 to: 28) -> nil (29 to: 55) -> 0 (56 to: 174) -> 1 (175 to: 299) -> 2 (300 to: 2338) -> 3) ...)"
cursor memory object: stream atTimes: ((cursor minTimeIndexFor: someContext) to: (cursor maxTimeIndexFor: someContext)) collect: #position. "a TDBMemorySlice(... (18 to: 28) -> nil (29 to: 36) -> 0) ...)"
The following example illustrates that historic range queries typically need to perform a lot of error handling and need to copy objects for later reuse (#proxyHacks):
cursor object: stream collect: [:ea | [(ea originalContents first: ea position) copy] on: Error do: #yourself]. "a TDBMemorySlice((0 to: 23) -> MessageNotUnderstood: UndefinedObject>>first: (24 to: 28) -> MessageNotUnderstood: UndefinedObject>>- (29 to: 55) -> '''' (56 to: 174) -> ''\'' (175 to: 299) -> ''\w'' (300 to: 2339) -> ''\w+'')"
cursor object: stream collect: [:ea | [(ea originalContents first: ea position) copy] on: Error do: #yourself]. "a TDBMemorySlice((0 to: 23) -> MessageNotUnderstood: UndefinedObject>>first: (24 to: 28) -> MessageNotUnderstood: UndefinedObject>>- (29 to: 55) -> '''' (56 to: 174) -> ''\'' (175 to: 299) -> ''\w'' (300 to: 2338) -> ''\w+'')"
The resulting memory slices can be accessed and transformed. Noticeably, when you operate on the discretized values from a memory slice, your code will likely operate on transparent range proxies that represent a value in an entire time range. A range proxy will behave similar to a normal proxy, but if it is sent further messages that reveal any state that has changed within the time range, the proxy will signal a fray out error. For more details, please refer to the class comments in TDBMemorySlice and TDBRangeProxy.!
]style[(14 294 43 2 25 1 7 2 11 14 2 5 1 7 4 26 36 2 8 7 1 12 1 5 2 29 10 2 8 17 18 2 10 5 2 29 13 2 8 20 3 3 1 1 1 3 1 6 1 2 1 1 19 11 1 3 49 13 6 2 19 7 2 8 15 13 10 1 9 2 14 5 3 119 13 24 32 39 17 5 25 65 15 3 25 82 6 54 7 197 7 8 7 1 1 2 8 2 5 9 7 8 7 1 1 7 16 12 1 2 8 2 3 9 7 8 7 1 1 7 16 5 1 2 8 2 3 186 7 8 7 1 1 7 16 12 1 2 4 2 4 44 8 58 4 1 16 11 11 3 25 41 7 8 8 1 9 2 121 7 6 1 7 8 8 2 1 7 16 12 1 1 3 1 1 7 16 12 1 2 8 1 9 2 65 155 11 2 1 8 7 8 8 3 2 1 1 1 1 1 2 1 16 1 6 1 2 1 8 1 1 4 1 1 3 7 3 1 9 3 219 50 134 13 223 14 58 14 5 13 1)a0b,a0,a0dTraceDebuggerHelp openScriptingAPIWorkspace;;,a0,a0b,a0,,b,,c000000114,,c114000114n,,c000000114,,b,,b,,c000000114,,c000000114,,c000000114,,c000114114i,,b,,c000000114,,b,,c000000114,,c000114114i,,b,,c000000114,,c000000114,,cgray;,,c000000114,,c000000114,,c000000114,,c000114000,,c000000114,c000114000,,c000114114i,,c000000114,,c000114114i,,b,,c000000114,,c000000114,,c000000114,,c000114114i,,u,,LTDBCursor Comment;,,b,,Rcode://
ToolSet browseClass: TDBCursor category: ''stepping'';,,LTDBCursor class exampleStepping;,,c000000114,,b,,Rcode://
]style[(14 294 43 2 25 1 7 2 11 14 2 5 1 7 4 26 36 2 8 7 1 12 1 5 2 29 10 2 8 17 18 2 10 5 2 29 13 2 8 20 3 3 1 1 1 3 1 6 1 2 1 1 19 11 1 3 49 13 6 2 19 7 2 8 15 13 10 1 9 2 14 5 3 119 13 24 32 39 17 5 25 65 15 3 25 82 6 54 7 197 7 8 7 1 1 2 8 2 5 9 7 8 7 1 1 7 16 12 1 2 8 2 3 9 7 8 7 1 1 7 16 5 1 2 8 2 3 186 7 8 7 1 1 7 16 12 1 2 4 2 4 44 8 58 4 1 16 11 11 3 25 41 7 8 8 1 9 2 121 7 6 1 7 8 8 2 1 7 16 12 1 1 3 1 1 7 16 12 1 2 8 1 9 2 65 155 11 2 1 8 7 8 8 3 2 1 1 1 1 1 2 1 16 1 6 1 2 1 8 1 1 4 1 1 3 7 3 1 9 3 219 50 134 13 223 14 58 14 5 13 1)a0b,a0,a0dTraceDebuggerHelp openScriptingAPIWorkspace;;,a0,a0b,a0,,b,,c000000113,,c113000113n,,c000000113,,b,,b,,c000000113,,c000000113,,c000000113,,c000113113i,,b,,c000000113,,b,,c000000113,,c000113113i,,b,,c000000113,,c000000113,,cgray;,,c000000113,,c000000113,,c000000113,,c000113000,,c000000113,c000113000,,c000113113i,,c000000113,,c000113113i,,b,,c000000113,,c000000113,,c000000113,,c000113113i,,u,,LTDBCursor Comment;,,b,,Rcode://
ToolSet browseClass: TDBCursor category: ''stepping'';,,LTDBCursor class exampleStepping;,,c000000113,,b,,Rcode://
ToolSet browse: TDBCursor selector: #memory;,,Rcode://
ToolSet browse: TDBCursor selector: #object:atTime:;,,c000000114,,c000000114,,c114000000,,c000000114,,c000114114i,,c000000114,,c000000114,,c000114000,,c000000114,,c000114000,,c000000114,,c000114114i,,c000000114,,c000000114,,c000114000,,c000000114,,c000114000,,c000000114,,c000114114i,,c000000114,,c000000114,,c000114000,,c000000114,,c000114000,,c000000114,,c000114114i,,LTDBProxy Comment;,,c000000114,,c000000114,,Rcode://
self systemNavigation browseAllImplementorsOf: #proxyHacks;,,b,,c000000114,,c000000114,,c000000114,,c000114114i,,c000000114,,c000000114,,c000000114,,c000114000,,c000000114,,c000114000,,c000000114,,c000114000,,c000000114,,c000114000,,c000000114,,c000000114,,c000114114i,,Rcode://
self systemNavigation browseAllImplementorsOf: #proxyHacks;,,c000114114i,,c000000114,,c000000114,,c000000114,,cgray;,,c000114000,c114000114,c000000114,,c000000114,,c000000114,,c000000114,,c000000114,c114000114,,c000000114,c000114000,,c000000114,,c000000114,,c000000114,,c000114114i,,a0,Rcode://
ToolSet browse: TDBCursor selector: #object:atTime:;,,c000000113,,c000000113,,c113000000,,c000000113,,c000113113i,,c000000113,,c000000113,,c000113000,,c000000113,,c000113000,,c000000113,,c000113113i,,c000000113,,c000000113,,c000113000,,c000000113,,c000113000,,c000000113,,c000113113i,,c000000113,,c000000113,,c000113000,,c000000113,,c000113000,,c000000113,,c000113113i,,LTDBProxy Comment;,,c000000113,,c000000113,,Rcode://
self systemNavigation browseAllImplementorsOf: #proxyHacks;,,b,,c000000113,,c000000113,,c000000113,,c000113113i,,c000000113,,c000000113,,c000000113,,c000113000,,c000000113,,c000113000,,c000000113,,c000113000,,c000000113,,c000113000,,c000000113,,c000000113,,c000113113i,,Rcode://
self systemNavigation browseAllImplementorsOf: #proxyHacks;,,c000113113i,,c000000113,,c000000113,,c000000113,,cgray;,,c000113000,c113000113,c000000113,,c000000113,,c000000113,,c000000113,,c000000113,c113000113,,c000000113,c000113000,,c000000113,,c000000113,,c000000113,,c000113113i,,a0,Rcode://
TDBMemorySlice>>#rangeValueAtTime:;,a0,LTDBRetracingFrayOut Comment;,a0,LTDBMemorySlice Comment;,a0,LTDBRangeProxy Comment;,a0!' readStream nextChunkText)
key: #basicScriptingAPIs;
shouldStyle: false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"basicImplementation" : "ct 12/28/2023 23:49",
"basicIntroduction" : "ct 12/29/2023 00:04",
"basicLearnMore" : "ct 12/28/2023 23:51",
"basicScriptingAPIs" : "ct 12/28/2023 21:30",
"basicScriptingAPIs" : "ct 1/2/2024 21:20",
"basicSelectorFor:" : "ct 3/18/2022 16:16",
"basicStructure" : "ct 12/28/2023 21:29",
"bookBlurb" : "ct 7/30/2022 17:32",
Expand Down

1 comment on commit bf4dea0

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed Screenshots/Help

This push caused a change of 2 artifacts against the default branch:

Please sign in to comment.