The Inbox: Monticello-fbs.581.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Monticello-fbs.581.mcz

commits-2
A new version of Monticello was added to project The Inbox:
http://source.squeak.org/inbox/Monticello-fbs.581.mcz

==================== Summary ====================

Name: Monticello-fbs.581
Author: fbs
Time: 21 December 2013, 8:00:04.242 pm
UUID: 26fba6b3-441c-434b-9d61-e39955f4a5ca
Ancestors: Monticello-cmm.580

Make Monticello loading/unloading Environmentally aware. Loading Monticello definitions is as simple as

["loading logic here"]
    on: EnvironmentRequest do: [:e | e resume: yourEnvironment].

=============== Diff against Monticello-cmm.580 ===============

Item was changed:
  ----- Method: MCClassDefinition>>actualClass (in category 'accessing') -----
  actualClass
+ | binding environment |
+ environment := EnvironmentRequest signal ifNil: [Smalltalk globals].
+ binding := environment bindingOf: name ifAbsent: [(KeyNotFound key: name) signal].
+ ^ binding value.!
- ^Smalltalk classNamed: self className!

Item was changed:
  ----- Method: MCClassDefinition>>createClass (in category 'installing') -----
  createClass
+ | environment superClass class composition |
+ environment := EnvironmentRequest signal ifNil: [Smalltalk globals].
- | superClass class composition |
  superClass := superclassName == #nil ifFalse:
+ [(environment bindingOf: superclassName) value].
+ superClass ifNil: [(KeyNotFound key: superclassName) signal].
- [Smalltalk at: superclassName].
  [class := (ClassBuilder new)
  name: name
+ inEnvironment: environment
- inEnvironment: (EnvironmentRequest signal ifNil: [superClass environment])
  subclassOf: superClass
  type: type
  instanceVariableNames: self instanceVariablesString
  classVariableNames: self classVariablesString
  poolDictionaries: self sharedPoolsString
  category: category.
  ] on: Warning, DuplicateVariableError do:[:ex| ex resume].
 
  "The following is written to support traits unloading"
  composition := self traitComposition ifNil: [Array new] ifNotNil: [:traitComposition | Compiler evaluate: traitComposition].
  (composition isCollection and:[composition isEmpty and:[class traitComposition isEmpty]]) ifFalse:[
  class setTraitComposition: composition asTraitComposition.
  ].
 
  composition := self classTraitComposition ifNil: [Array new] ifNotNil: [:traitComposition | Compiler evaluate: traitComposition].
  (composition isCollection and:[composition isEmpty and:[class class traitComposition isEmpty]]) ifFalse:[
  class class setTraitComposition: composition asTraitComposition.
  ].
 
  ^class!

Item was changed:
  ----- Method: MCClassDefinition>>unload (in category 'installing') -----
  unload
+ | environment |
+ environment := EnvironmentRequest signal ifNil: [Smalltalk globals].
+ environment removeClassNamed: name.!
- Smalltalk removeClassNamed: name!

Item was changed:
  ----- Method: MCMethodDefinition>>actualClass (in category 'accessing') -----
  actualClass
+ | actualClass binding environment |
+ environment := EnvironmentRequest signal ifNil: [Smalltalk globals].
+ binding := environment bindingOf: className ifAbsent: [(KeyNotFound key: className) signal].
+ actualClass := binding value.
+ ^ classIsMeta
+ ifTrue: [actualClass classSide]
+ ifFalse: [actualClass].!
- ^Smalltalk at: className
- ifPresent: [:class | classIsMeta ifTrue: [class classSide] ifFalse: [class]]!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Monticello-fbs.581.mcz

Frank Shearar-3
On 21 December 2013 22:39,  <[hidden email]> wrote:

> A new version of Monticello was added to project The Inbox:
> http://source.squeak.org/inbox/Monticello-fbs.581.mcz
>
> ==================== Summary ====================
>
> Name: Monticello-fbs.581
> Author: fbs
> Time: 21 December 2013, 8:00:04.242 pm
> UUID: 26fba6b3-441c-434b-9d61-e39955f4a5ca
> Ancestors: Monticello-cmm.580
>
> Make Monticello loading/unloading Environmentally aware. Loading Monticello definitions is as simple as
>
> ["loading logic here"]
>     on: EnvironmentRequest do: [:e | e resume: yourEnvironment].
>
> =============== Diff against Monticello-cmm.580 ===============

| ctrl b |
Installer sm update.
ctrl := Environment withName: 'CtrlEnv'.
ctrl import: Smalltalk globals.
[Installer sm install: 'Control'] on: EnvironmentRequest do: [:e | e
resume: ctrl].
b := Browser new.
b selectEnvironment: ctrl.
Browser openBrowserView: (b openEditString: nil) label: 'Heehee'.

Note how the Browser shows only those classes declared in the ctrl Environment.

frank

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Monticello-fbs.581.mcz

Frank Shearar-3
On 21 December 2013 22:44, Frank Shearar <[hidden email]> wrote:

> On 21 December 2013 22:39,  <[hidden email]> wrote:
>> A new version of Monticello was added to project The Inbox:
>> http://source.squeak.org/inbox/Monticello-fbs.581.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Monticello-fbs.581
>> Author: fbs
>> Time: 21 December 2013, 8:00:04.242 pm
>> UUID: 26fba6b3-441c-434b-9d61-e39955f4a5ca
>> Ancestors: Monticello-cmm.580
>>
>> Make Monticello loading/unloading Environmentally aware. Loading Monticello definitions is as simple as
>>
>> ["loading logic here"]
>>     on: EnvironmentRequest do: [:e | e resume: yourEnvironment].
>>
>> =============== Diff against Monticello-cmm.580 ===============
>
> | ctrl b |
> Installer sm update.
> ctrl := Environment withName: 'CtrlEnv'.
> ctrl import: Smalltalk globals.
> [Installer sm install: 'Control'] on: EnvironmentRequest do: [:e | e
> resume: ctrl].
> b := Browser new.
> b selectEnvironment: ctrl.
> Browser openBrowserView: (b openEditString: nil) label: 'Heehee'.
>
> Note how the Browser shows only those classes declared in the ctrl Environment.

Actually, the above doesn't work because Installer sm uses a fileIn
into a ChangeSet. At any rate, if you replace the "Installer sm
install: 'Control'" line with your own favourite mcz in your package
cache, things will work.

frank

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Monticello-fbs.581.mcz

Frank Shearar-3
On 23 December 2013 08:24, Frank Shearar <[hidden email]> wrote:

> On 21 December 2013 22:44, Frank Shearar <[hidden email]> wrote:
>> On 21 December 2013 22:39,  <[hidden email]> wrote:
>>> A new version of Monticello was added to project The Inbox:
>>> http://source.squeak.org/inbox/Monticello-fbs.581.mcz
>>>
>>> ==================== Summary ====================
>>>
>>> Name: Monticello-fbs.581
>>> Author: fbs
>>> Time: 21 December 2013, 8:00:04.242 pm
>>> UUID: 26fba6b3-441c-434b-9d61-e39955f4a5ca
>>> Ancestors: Monticello-cmm.580
>>>
>>> Make Monticello loading/unloading Environmentally aware. Loading Monticello definitions is as simple as
>>>
>>> ["loading logic here"]
>>>     on: EnvironmentRequest do: [:e | e resume: yourEnvironment].
>>>
>>> =============== Diff against Monticello-cmm.580 ===============
>>
>> | ctrl b |
>> Installer sm update.
>> ctrl := Environment withName: 'CtrlEnv'.
>> ctrl import: Smalltalk globals.
>> [Installer sm install: 'Control'] on: EnvironmentRequest do: [:e | e
>> resume: ctrl].
>> b := Browser new.
>> b selectEnvironment: ctrl.
>> Browser openBrowserView: (b openEditString: nil) label: 'Heehee'.
>>
>> Note how the Browser shows only those classes declared in the ctrl Environment.
>
> Actually, the above doesn't work because Installer sm uses a fileIn
> into a ChangeSet. At any rate, if you replace the "Installer sm
> install: 'Control'" line with your own favourite mcz in your package
> cache, things will work.

Like this:

| ctrl b |
Smalltalk globals exportSelf. "<-- only run this if you've not
previously done this or you'll be told that "Error: Cannot store into
read-only bindings"
ctrl := Environment withName: 'Control Env'.
ctrl import: Smalltalk globals.
[Installer ss3
    project: 'Control';
     install: 'Control-fbs.22'] on: EnvironmentRequest do: [:e | e
resume: ctrl].
b := Browser new
selectEnvironment: ctrl;
yourself.
Browser openBrowserView: (b openEditString: nil) label: b defaultBrowserTitle

Additionally, the submission as it stands breaks the "Changes" button.
If you load this mcz and try see, for example, what changes the Inbox
System-cmm.497.mcz will make, you'll get a KeyNotFound error because
there's no class called #Author in the current environment. (Indeed,
at this point NO environment has such a class.)

This happens, it seems, because the old MCMethodDefinition >>
#actualClass returns nil if it can't find a class. I really, really
hate this kind of thing: both returning nil, and _implicitly_
returning nil (because, you know, you haven't memorised the fact that
#at:ifPresent: returns nil if the key's missing).

At any rate, I'm not going to shave that particular yak yet, so just
imagine for the purposes of review that the block throwing the
KeyNotFound just has a non-local nil-return instead.

frank