Autoload.st
branchjv
changeset 18120 e3a375d5f6a8
parent 18105 3a3a3e0ac47f
parent 17124 9c3c21def1fe
child 18276 07269d05da24
equal deleted inserted replaced
18119:cb7a12afe736 18120:e3a375d5f6a8
    34 "
    34 "
    35 !
    35 !
    36 
    36 
    37 documentation
    37 documentation
    38 "
    38 "
    39     In memory limited systems (as my 8Mb 386 is) all seldom-used classes are made
    39     Autoload is a stub for an 'as yet unloaded' class.
    40     subclasses of this class. 
    40 
    41     Autoload catches all messages and files-In the corresponding code
    41     In memory limited systems (as my original 8Mb 386 system was), 
    42     when first used. 
    42     all seldom-used classes were made subclasses of this class. 
    43     Then the caught message is resent to the (now existing) class.
    43     Autoload catches all messages sent to it, and files-in the real class's 
    44 
    44     code when first used. Then the caught message is resent to the (now existing) class.
       
    45 
       
    46     A note from later days:
       
    47         Theses days, systems usually have enough memory to allow
       
    48         having all classes present, so many of the classes which used to be
       
    49         autoloaded are no longer these days. However, a number of examples or
       
    50         very seldom used frameworks are still present as autoloaded.
       
    51         Instead of using autoloaded classes, it is now recommended to bundle
       
    52         extra classes into packages, which are loaded en-bloque.
       
    53         Packages can be compiled to a shared class library and thus be loaded
       
    54         much faster (there is no need to parse and compile source files).
       
    55 
       
    56     Lazy loading:
    45     Class files are searched along the searchPath (see Smalltalk),
    57     Class files are searched along the searchPath (see Smalltalk),
    46     and any of binary-classFile, byteCode-classFile or sourceFile are
    58     and any of binary-classFile, byteCode-classFile or sourceFile are loaded, 
    47     loaded, whichever is found first. For binaries to be loaded,
    59     whichever is found first. 
    48     these must be found in the 'bin' directory. Sources must be found
    60     For binaries to be loaded, these must be found in a package-subdirectory
    49     in the 'source' directory.
    61     along the so called package path. 
    50     (Usually, Autoload classes finds the source file and loads that one).
    62     Sources in a package directory along the source path.
    51 
    63     In practice, most Autoloaded classes are found and loaded as source file.
    52     When started, the patches startup script arranges for the abbreviation
    64 
    53     file 'include/abbrev.stc' to be read and installs autoload stubs for
    65     Initial Setup of Auoload Stubs:
    54     all classes listed in that file, which do not exist already.
    66     At initial startup (i.e. when ST/X is NOT coming up with an image),
    55     The abbreviation file is maintained by the production environment
    67     the 'patches' startup script recursively walks along all directories
    56     and updated by makefile rules - therefore, it should not be edited
    68     below the TOP directory (that is one above the stx folder),
    57     manually.
    69     and installs autoload stubs for all .st class files found, for which no
    58 
    70     corresponding class is already present.
    59     Late addition: above comment is no longer true - I have made now almost
    71     As you can imagine, this takes a long time and makes the initial startup quite slow.
    60     all Demos & Goodies be autoloaded ... even for big systems.
    72     Therefore, this scheme is no longer the recommended one and we (at exept)
       
    73     always start ST/X with the '--quick' option, which skips this scan operation.
       
    74 
       
    75     Advantage of Autoload stubs:
       
    76     Autoload stubs make it easier for a beginner to ST/X, to see what frameworks and classes
       
    77     are there, as they appear in the browser with category and class name (although no
       
    78     more details are initially visible.
    61 
    79 
    62     [class variables:]
    80     [class variables:]
    63         
    81         
    64         LazyLoading             <Boolean>       if true, the loaded classes 
    82         LazyLoading             <Boolean>       if true, the loaded classes 
    65                                                 methods will NOT be compiled at 
    83                                                 methods will NOT be compiled at 
   582     "catch  - load the class and send it to the real one"
   600     "catch  - load the class and send it to the real one"
   583 
   601 
   584     ^ self doesNotUnderstand:(Message selector:#fromString: argument:aString)
   602     ^ self doesNotUnderstand:(Message selector:#fromString: argument:aString)
   585 !
   603 !
   586 
   604 
       
   605 handle:handler do:aBlock
       
   606     ^ self doesNotUnderstand:(Message selector:#handle:do: with:handler with:aBlock)
       
   607 !
       
   608 
   587 isAbstract
   609 isAbstract
   588     ^ false "/ actually: dont know, but do not want to load my class for this query
   610     ^ false "/ actually: dont know, but do not want to load my class for this query
   589 !
   611 !
   590 
   612 
   591 new
   613 new
   816 ! !
   838 ! !
   817 
   839 
   818 !Autoload class methodsFor:'documentation'!
   840 !Autoload class methodsFor:'documentation'!
   819 
   841 
   820 version
   842 version
   821     ^ '$Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.167 2013-10-15 14:04:12 stefan Exp $'
   843     ^ '$Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.169 2014-11-26 09:08:21 cg Exp $'
   822 !
   844 !
   823 
   845 
   824 version_CVS
   846 version_CVS
   825     ^ '$Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.167 2013-10-15 14:04:12 stefan Exp $'
   847     ^ '$Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.169 2014-11-26 09:08:21 cg Exp $'
   826 ! !
   848 ! !
   827 
   849 
   828 
   850 
   829 Autoload initialize!
   851 Autoload initialize!