Gnu Smalltalk Library Reference Version 3.2.5 24 November 2017
Total Page:16
File Type:pdf, Size:1020Kb
gnu Smalltalk Library Reference Version 3.2.5 24 November 2017 by Paolo Bonzini Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled \GNU Free Documentation License". 1 3 1 Base classes 1.1 Tree Classes documented in this manual are boldfaced. Autoload Object Behavior ClassDescription Class Metaclass BlockClosure Boolean False True CObject CAggregate CArray CPtr CString CCallable CCallbackDescriptor CFunctionDescriptor CCompound CStruct CUnion CScalar CChar CDouble CFloat CInt CLong CLongDouble CLongLong CShort CSmalltalk CUChar CByte CBoolean CUInt CULong CULongLong CUShort ContextPart 4 GNU Smalltalk Library Reference BlockContext MethodContext Continuation CType CPtrCType CArrayCType CScalarCType CStringCType Delay Directory DLD DumperProxy AlternativeObjectProxy NullProxy VersionableObjectProxy PluggableProxy SingletonProxy DynamicVariable Exception Error ArithmeticError ZeroDivide MessageNotUnderstood SystemExceptions.InvalidValue SystemExceptions.EmptyCollection SystemExceptions.InvalidArgument SystemExceptions.AlreadyDefined SystemExceptions.ArgumentOutOfRange SystemExceptions.IndexOutOfRange SystemExceptions.InvalidSize SystemExceptions.NotFound SystemExceptions.PackageNotAvailable SystemExceptions.InvalidProcessState SystemExceptions.InvalidState SystemExceptions.NotIndexable SystemExceptions.ProcessTerminated SystemExceptions.ReadOnlyObject SystemExceptions.WrongClass SystemExceptions.MustBeBoolean SystemExceptions.MutationError SystemExceptions.NotEnoughElements SystemExceptions.NotImplemented SystemExceptions.NotYetImplemented SystemExceptions.ShouldNotImplement SystemExceptions.SubclassResponsibility SystemExceptions.WrongMessageSent SystemExceptions.VMError Chapter 1: Base classes 5 SystemExceptions.BadReturn SystemExceptions.NoRunnableProcess SystemExceptions.PrimitiveFailed SystemExceptions.CInterfaceError SystemExceptions.FileError SystemExceptions.WrongArgumentCount SystemExceptions.SecurityError SystemExceptions.UserInterrupt SystemExceptions.VerificationError Halt Notification SystemExceptions.EndOfStream SystemExceptions.ProcessBeingTerminated Warning SystemExceptions.UnhandledException ExceptionSet FilePath File VFS.ArchiveMember VFS.TmpFileArchiveMember VFS.StoredZipMember VFS.FileWrapper VFS.ArchiveFile VFS.ZipFile FileSegment Getopt Iterable Collection Bag HashedCollection Dictionary BindingDictionary AbstractNamespace Namespace RootNamespace SystemDictionary LookupTable IdentityDictionary MethodDictionary WeakValueLookupTable WeakValueIdentityDictionary WeakKeyDictionary WeakKeyIdentityDictionary Set IdentitySet WeakSet WeakIdentitySet 6 GNU Smalltalk Library Reference MappedCollection SequenceableCollection ArrayedCollection Array WeakArray ByteArray CharacterArray String Symbol UnicodeString CompiledCode CompiledBlock CompiledMethod Interval LargeArrayedCollection LargeArray LargeByteArray LargeWordArray WordArray LinkedList Semaphore OrderedCollection RunArray SortedCollection Stream FileDescriptor FileStream Generator ObjectDumper PositionableStream ReadStream WriteStream ReadWriteStream Random TextCollector Kernel.PackageInfo Package Link Process CallinProcess SymLink Magnitude Character UnicodeCharacter Date DateTime LookupKey Chapter 1: Base classes 7 Association HomedAssociation VariableBinding DeferredVariableBinding ProcessVariable Number Float FloatD FloatE FloatQ Fraction Integer LargeInteger LargeNegativeInteger LargePositiveInteger LargeZeroInteger SmallInteger ScaledDecimal Time Duration Memory Message DirectedMessage MethodInfo NetClients.URIResolver NetClients.URL ObjectMemory PackageLoader Permission Point ProcessEnvironment ProcessorScheduler Rectangle RecursionLock Regex RegexResults SecurityPolicy SharedQueue UndefinedObject ValueAdaptor NullValueHolder PluggableAdaptor DelayedAdaptor ValueHolder Promise 8 GNU Smalltalk Library Reference 1.2 AbstractNamespace Defined in namespace Smalltalk Superclass: BindingDictionary Category: Language-Implementation I am a special form of dictionary. Classes hold on an instance of me; it is called their `environment'. 1.2.1 AbstractNamespace class: instance creation new Disabled - use #new to create instances primNew: parent name: spaceName Private - Create a new namespace with the given name and parent, and add to the parent a key that references it. 1.2.2 AbstractNamespace: accessing allAssociations Answer a Dictionary with all of the associations in the receiver and each of its superspaces (duplicate keys are associated to the associations that are deeper in the namespace hierarchy) allBehaviorsDo: aBlock Evaluate aBlock once for each class and metaclass in the namespace. allClassObjectsDo: aBlock Evaluate aBlock once for each class and metaclass in the namespace. allClassesDo: aBlock Evaluate aBlock once for each class in the namespace. allMetaclassesDo: aBlock Evaluate aBlock once for each metaclass in the namespace. classAt: aKey Answer the value corrisponding to aKey if it is a class. Fail if either aKey is not found or it is associated to something different from a class. classAt: aKey ifAbsent: aBlock Answer the value corrisponding to aKey if it is a class. Evaluate aBlock and answer its result if either aKey is not found or it is associated to something different from a class. 1.2.3 AbstractNamespace: compiling addSharedPool: aDictionary Import the given bindings for classes compiled with me as environment. import: aDictionary Import the given bindings for classes compiled with me as environment. removeSharedPool: aDictionary Remove aDictionary from my list of direct pools. Chapter 1: Base classes 9 sharedPoolDictionaries Answer the shared pools (not names) imported for my classes. 1.2.4 AbstractNamespace: copying copyEmpty: newSize Answer an empty copy of the receiver whose size is newSize whileCurrentDo: aBlock Evaluate aBlock with the current namespace set to the receiver. Answer the result of the evaluation. 1.2.5 AbstractNamespace: namespace hierarchy addSubspace: aSymbol Create a namespace named aSymbol, add it to the receiver's subspaces, and answer it. allSubassociationsDo: aBlock Invokes aBlock once for every association in each of the receiver's subspaces. allSubspaces Answer the direct and indirect subspaces of the receiver in a Set allSubspacesDo: aBlock Invokes aBlock for all subspaces, both direct and indirect. allSuperspacesDo: aBlock Evaluate aBlock once for each of the receiver's superspaces includesClassNamed: aString Answer whether the receiver or any of its superspaces include the given class { note that this method (unlike #includesKey:) does not require aString to be interned and (unlike #includesGlobalNamed:) only returns true if the global is a class object. includesGlobalNamed: aString Answer whether the receiver or any of its superspaces include the given key { note that this method (unlike #includesKey:) does not require aString to be interned but (unlike #includesClassNamed:) returns true even if the global is not a class object. removeSubspace: aSymbol Remove my subspace named aSymbol from the hierarchy. selectSubspaces: aBlock Return a Set of subspaces of the receiver satisfying aBlock. selectSuperspaces: aBlock Return a Set of superspaces of the receiver satisfying aBlock. siblings Answer all the other children of the same namespace as the receiver. siblingsDo: aBlock Evaluate aBlock once for each of the other root namespaces, passing the names- pace as a parameter. 10 GNU Smalltalk Library Reference subspaces Answer the receiver's direct subspaces subspacesDo: aBlock Invokes aBlock for all direct subspaces. superspace Answer the receiver's superspace. superspace: aNamespace Set the superspace of the receiver to be 'aNamespace'. Also adds the receiver as a subspace of it. withAllSubspaces Answer a Set containing the receiver together with its direct and indirect sub- spaces withAllSubspacesDo: aBlock Invokes aBlock for the receiver and all subclasses, both direct and indirect. 1.2.6 AbstractNamespace: overrides for superspaces inheritedKeys Answer a Set of all the keys in the receiver and its superspaces set: key to: newValue Assign newValue to the variable named as specified by `key'. This method won't define a new variable; instead if the key is not found it will searchin superspaces and raising an error if the variable cannot be found in any of the superspaces. Answer newValue. set: key to: newValue ifAbsent: aBlock Assign newValue to the variable named as specified by `key'. This method won't define a new variable; instead if the key is not found it will searchin superspaces and evaluate aBlock if it is not found. Answer newValue. values Answer a Bag containing the values of the receiver 1.2.7 AbstractNamespace: printing name Answer the receiver's name name: aSymbol Change the receiver's name to aSymbol nameIn: aNamespace Answer Smalltalk code compiling to the receiver when the current namespace is aNamespace printOn: aStream Print a representation of the receiver storeOn: aStream Store Smalltalk code compiling to the receiver Chapter 1: Base classes 11 1.2.8 AbstractNamespace: testing isNamespace Answer `true'. isSmalltalk Answer `false'. 1.3 AlternativeObjectProxy Defined in namespace Smalltalk Superclass: DumperProxy Category: Streams-Files I am a proxy that uses the same ObjectDumper to store an object