Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transcript open via the menu is broken #17861

Open
Ducasse opened this issue Feb 20, 2025 · 2 comments
Open

Transcript open via the menu is broken #17861

Ducasse opened this issue Feb 20, 2025 · 2 comments
Milestone

Comments

@Ducasse
Copy link
Member

Ducasse commented Feb 20, 2025

Why because we get a NonInteractiveTranscript and it does not understand open.

  • First remark this is not super smart to have objects that we substitute and do not have the same API.

So NonInteractiveTranscript is put in the Transcript global variable during the bootstrap.

initializeCommandLineHandlerAndErrorHandling
	"This method is run before the new bootstrapped image is saved!"
	
	ProcessorScheduler initialize.
	Delay initialize.
	ProcessorScheduler startUp.
	OSPlatform startUp: true.
	SmallInteger initialize.
	String initialize.
	ByteString initialize. 
	Float initialize.
	
	...

	Smalltalk globals
		at: #Transcript
		put: (NonInteractiveTranscript stdout install).

Now the CommonTools during their initialization are doing.

initDefaultToolSet

	"Query the system for registering tools"
	"we cannot afford to show warnings because not all tools e.g Debugger, Inspector are registered yet"

	[
	Object withAllSubclassesDo: [:ea |
	"evaluate only for classes which directly implement this message,
	not via subclassing"
		(ea isMeta and: [
			ea includesSelector: #registerToolsOn: ]) ifTrue: [
			 ea instanceSide registerToolsOn: self  ]].
	] on: Warning do: [:ex | ex resume ]

and we have the following

ThreadSafeTranscript class >> registerToolsOn: aRegistry

	aRegistry register: Transcript as: #transcript

So here the idea was to install in the toolRegistry the globally accessible value.

ThreadSafeTranscript class >>install

	self installThreadSafeAsTranscript

ThreadSafeTranscript class >>installThreadSafeAsTranscript
	<script>

	Smalltalk globals at: #Transcript put: (self new)

But we also have

NonInteractiveTranscript >> install
	"Install me as a replacement for Transcript"

	Smalltalk globals
		at: #Transcript
		put: self

Now in my image Transcript refers to a threadsafe one so it means that
the registration happened at a point where Transcript global referred to the NonInteractive one.

@Ducasse
Copy link
Member Author

Ducasse commented Feb 20, 2025

Indeed doing

Smalltalk tools initDefaultToolSet make the menu access via Smalltalk tools toolNamed: #transcript works again.

Now this is not the correct solution

@Ducasse Ducasse added this to the 13.0.0 milestone Feb 22, 2025
@Ducasse
Copy link
Member Author

Ducasse commented Feb 22, 2025

Smalltalk tools initDefaultToolSet fixes it so it should be called too early (now this is strange since transcript is defined early).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant