How do I save contents of Workspace into a collection?
Hi guys, My images are gathering a number of Workspaces whose contents I don't want to delete. I want to create a collection of Workspace contents along this defintion: Description Date Category Content (the actual text in the Workspace). In the final version I would like to be able to select a workspace and simply click a button or a menu item and get a dialog where I can enter the Description, Category and Date with the Workspace contents automatically captured into a text box. Copying and pasting the contents would be okay to start with. Filing it out would be another aspect later. What kind of array would best suited to the task? There is quite a number of them depicted here: http://www.jmcsweeney.co.uk/computing/m206/collections_intro.php What could be the best way to go about it? For those who are curious I am experimenting with the original ideas of Smalltalk where a computer user would do everything in Smalltalk workspace/desktop. I am intrigued by the possibility and somehow it seems eminently doable. -- Frank Church ======================= http://devblog.brahmancreations.com
Frank Church wrote
I want to create a collection of Workspace contents...What kind of array would best suited to the task?
I usually just start with an OrderedCollection until I feel the need for something more complicated. It's like an Array, but will grow dynamically. Two things to check out that already exist in the system: * you can save workspace contents to a file by clicking the little arrow in the top right of the workspace window and select "Save As..." * check out ScriptManager, which is a GUI for organizing and saving workspaces. It was included in Pharo by default in 1.3 (I think) and has a repo on sqs... search the list to see how/if it can be loaded into later Pharos. HTH, Sean -- View this message in context: http://forum.world.st/How-do-I-save-contents-of-Workspace-into-a-collection-... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
On 7 January 2013 13:01, Sean P. DeNigris <sean@clipperadams.com> wrote:
Frank Church wrote
I want to create a collection of Workspace contents...What kind of array would best suited to the task?
I usually just start with an OrderedCollection until I feel the need for something more complicated. It's like an Array, but will grow dynamically.
Two things to check out that already exist in the system: * you can save workspace contents to a file by clicking the little arrow in the top right of the workspace window and select "Save As..." * check out ScriptManager, which is a GUI for organizing and saving workspaces. It was included in Pharo by default in 1.3 (I think) and has a repo on sqs... search the list to see how/if it can be loaded into later Pharos.
I tried ScriptManager but it appears to save the files in a binary format. It wouldn't open in a text editor . I am interested in something which persists in Smalltalk, so I can just browse them without saving to disk, 'The Smalltalk Way'. Saving to disk is an option though. Is there a way of selecting a workspace and extracting the text it contains. Something like a small script to enumerate all open Workspaces and printing out their text contents in a Transcript? I saw your blog article about using Smalltalk to view the contents of your mailbox and the other about parsing a feeds contents and I want to try something similar as a start. My thoughts are along these lines. 1. Define a class consisting of workspace and a method which returns their text content. 2. Define collection 3. List workspaces and add to collection. I am not sure if this will replicate the workspaces perhaps they should be 'pointers' to the workspaces 4. inspect/explore the results like you did in your blog. Thanks HTH,
Sean
-- View this message in context: http://forum.world.st/How-do-I-save-contents-of-Workspace-into-a-collection-... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
-- Frank Church ======================= http://devblog.brahmancreations.com
On 7 January 2013 14:15, Frank Church <vfclists@gmail.com> wrote:
On 7 January 2013 13:01, Sean P. DeNigris <sean@clipperadams.com> wrote:
Frank Church wrote
I want to create a collection of Workspace contents...What kind of array would best suited to the task?
I usually just start with an OrderedCollection until I feel the need for something more complicated. It's like an Array, but will grow dynamically.
Two things to check out that already exist in the system: * you can save workspace contents to a file by clicking the little arrow in the top right of the workspace window and select "Save As..." * check out ScriptManager, which is a GUI for organizing and saving workspaces. It was included in Pharo by default in 1.3 (I think) and has a repo on sqs... search the list to see how/if it can be loaded into later Pharos.
I tried ScriptManager but it appears to save the files in a binary format. It wouldn't open in a text editor .
I am interested in something which persists in Smalltalk, so I can just browse them without saving to disk, 'The Smalltalk Way'. Saving to disk is an option though.
Is there a way of selecting a workspace and extracting the text it contains. Something like a small script to enumerate all open Workspaces and printing out their text contents in a Transcript?
I saw your blog article about using Smalltalk to view the contents of your mailbox and the other about parsing a feeds contents and I want to try something similar as a start.
My thoughts are along these lines.
1. Define a class consisting of workspace and a method which returns their text content. 2. Define collection 3. List workspaces and add to collection. I am not sure if this will replicate the workspaces perhaps they should be 'pointers' to the workspaces 4. inspect/explore the results like you did in your blog.
Thanks
HTH,
Sean
After further investigation this is what I found. When I shift click a Workspace window the item selected is usually a PluggableTextMorph or a TextMorphForEditView. When it is a PluggableTextMorph it owns a TextMorphforEditView which was not picked by the click. Inspecting or exploring the hierarchy shows that is owned by a SystemWindow of a Model Workspace further up the hierachy. What code do I need to first list all TextMorphforEditView(s) in the system and lookup the ownership hierarchy to determine whether the model of the SystemWindow is a Workspace or a Transcript?
--
Frank Church
======================= http://devblog.brahmancreations.com
-- Frank Church ======================= http://devblog.brahmancreations.com
On 7 January 2013 22:12, Frank Church <vfclists@gmail.com> wrote:
On 7 January 2013 14:15, Frank Church <vfclists@gmail.com> wrote:
On 7 January 2013 13:01, Sean P. DeNigris <sean@clipperadams.com> wrote:
Frank Church wrote
I want to create a collection of Workspace contents...What kind of array would best suited to the task?
I usually just start with an OrderedCollection until I feel the need for something more complicated. It's like an Array, but will grow dynamically.
Two things to check out that already exist in the system: * you can save workspace contents to a file by clicking the little arrow in the top right of the workspace window and select "Save As..." * check out ScriptManager, which is a GUI for organizing and saving workspaces. It was included in Pharo by default in 1.3 (I think) and has a repo on sqs... search the list to see how/if it can be loaded into later Pharos.
I tried ScriptManager but it appears to save the files in a binary format. It wouldn't open in a text editor .
I am interested in something which persists in Smalltalk, so I can just browse them without saving to disk, 'The Smalltalk Way'. Saving to disk is an option though.
Is there a way of selecting a workspace and extracting the text it contains. Something like a small script to enumerate all open Workspaces and printing out their text contents in a Transcript?
I saw your blog article about using Smalltalk to view the contents of your mailbox and the other about parsing a feeds contents and I want to try something similar as a start.
My thoughts are along these lines.
1. Define a class consisting of workspace and a method which returns their text content. 2. Define collection 3. List workspaces and add to collection. I am not sure if this will replicate the workspaces perhaps they should be 'pointers' to the workspaces 4. inspect/explore the results like you did in your blog.
Thanks
HTH, Sean
After further investigation this is what I found.
When I shift click a Workspace window the item selected is usually a PluggableTextMorph or a TextMorphForEditView. When it is a PluggableTextMorph it owns a TextMorphforEditView which was not picked by the click.
Inspecting or exploring the hierarchy shows that is owned by a SystemWindow of a Model Workspace further up the hierachy.
What code do I need to first list all TextMorphforEditView(s) in the system and lookup the ownership hierarchy to determine whether the model of the SystemWindow is a Workspace or a Transcript?
just accept text in all workspaces (cmd-s) before doing it: Workspace allInstances collect: [:ea | ea contents ]
--
Frank Church
======================= http://devblog.brahmancreations.com
-- Frank Church
======================= http://devblog.brahmancreations.com
-- Best regards, Igor Stasenko.
On 7 January 2013 23:32, Igor Stasenko <siguctua@gmail.com> wrote:
Workspace allInstances collect: [:ea | ea contents
Following your example I used this expression 'TextMorphForEditView allInstances collect: [ :ea | ea text]'.to get the text in all the TextMorphForEditView instances without have to Cmd-S them first.. In my case I need to know if the TextMorphForEditView belongs to a Workspace. Is there a message for checking if an object is a child object of a particular class further up the hierarchy,.something along the lines of: isTrue(TextMorphForEditViewObject childOf: Workspace) and conversely isTrue(WorkspaceObject parentOf: TextMorphForEditView) ? -- Frank Church ======================= http://devblog.brahmancreations.com
On 8 January 2013 02:22, Frank Church <vfclists@gmail.com> wrote:
On 7 January 2013 23:32, Igor Stasenko <siguctua@gmail.com> wrote:
Workspace allInstances collect: [:ea | ea contents
Following your example I used this expression 'TextMorphForEditView allInstances collect: [ :ea | ea text]'.to get the text in all the TextMorphForEditView instances without have to Cmd-S them first..
In my case I need to know if the TextMorphForEditView belongs to a Workspace. Is there a message for checking if an object is a child object of a particular class further up the hierarchy,.something along the lines of:
isTrue(TextMorphForEditViewObject childOf: Workspace)
and conversely
isTrue(WorkspaceObject parentOf: TextMorphForEditView)
TextMorphForEditView allInstances select: [:morph | morph firstOwnerSuchThat: [:owner | (owner class isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ] something like that.
? -- Frank Church
======================= http://devblog.brahmancreations.com
-- Best regards, Igor Stasenko.
On 8 January 2013 03:52, Igor Stasenko <siguctua@gmail.com> wrote:
On 8 January 2013 02:22, Frank Church <vfclists@gmail.com> wrote:
On 7 January 2013 23:32, Igor Stasenko <siguctua@gmail.com> wrote:
Workspace allInstances collect: [:ea | ea contents
Following your example I used this expression 'TextMorphForEditView allInstances collect: [ :ea | ea text]'.to get the text in all the TextMorphForEditView instances without have to Cmd-S them first..
In my case I need to know if the TextMorphForEditView belongs to a Workspace. Is there a message for checking if an object is a child object of a particular class further up the hierarchy,.something along the lines of:
isTrue(TextMorphForEditViewObject childOf: Workspace)
and conversely
isTrue(WorkspaceObject parentOf: TextMorphForEditView)
TextMorphForEditView allInstances select: [:morph | morph firstOwnerSuchThat: [:owner | (owner class isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]
something like that.
or this: ... TextMorphForEditView allInstances select: [:morph | morph firstOwnerSuchThat: [:owner | (owner class isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] notNil ]
? -- Frank Church
======================= http://devblog.brahmancreations.com
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
On 8 January 2013 02:53, Igor Stasenko <siguctua@gmail.com> wrote:
On 8 January 2013 03:52, Igor Stasenko <siguctua@gmail.com> wrote:
On 8 January 2013 02:22, Frank Church <vfclists@gmail.com> wrote:
On 7 January 2013 23:32, Igor Stasenko <siguctua@gmail.com> wrote:
Workspace allInstances collect: [:ea | ea contents
Following your example I used this expression 'TextMorphForEditView allInstances collect: [ :ea | ea text]'.to get the text in all the TextMorphForEditView instances without have to Cmd-S them first..
In my case I need to know if the TextMorphForEditView belongs to a Workspace. Is there a message for checking if an object is a child
object of
a particular class further up the hierarchy,.something along the lines of:
isTrue(TextMorphForEditViewObject childOf: Workspace)
and conversely
isTrue(WorkspaceObject parentOf: TextMorphForEditView)
TextMorphForEditView allInstances select: [:morph | morph firstOwnerSuchThat: [:owner | (owner class isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]
something like that.
or this: ... TextMorphForEditView allInstances select: [:morph | morph firstOwnerSuchThat: [:owner | (owner class isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] notNil ]
? -- Frank Church
======================= http://devblog.brahmancreations.com
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
Do you care to rack some points at Stackoverflow 14203861, less I end up having to answer my own question (rather uncool) ? -- Frank Church ======================= http://devblog.brahmancreations.com
On 8 January 2013 02:53, Igor Stasenko <siguctua@gmail.com> wrote:
On 8 January 2013 03:52, Igor Stasenko <siguctua@gmail.com> wrote:
On 8 January 2013 02:22, Frank Church <vfclists@gmail.com> wrote:
On 7 January 2013 23:32, Igor Stasenko <siguctua@gmail.com> wrote:
Workspace allInstances collect: [:ea | ea contents
Following your example I used this expression 'TextMorphForEditView allInstances collect: [ :ea | ea text]'.to get the text in all the TextMorphForEditView instances without have to Cmd-S them first..
In my case I need to know if the TextMorphForEditView belongs to a Workspace. Is there a message for checking if an object is a child
object of
a particular class further up the hierarchy,.something along the lines of:
isTrue(TextMorphForEditViewObject childOf: Workspace)
and conversely
isTrue(WorkspaceObject parentOf: TextMorphForEditView)
TextMorphForEditView allInstances select: [:morph | morph firstOwnerSuchThat: [:owner | (owner class isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]
something like that.
or this: ... TextMorphForEditView allInstances select: [:morph | morph firstOwnerSuchThat: [:owner | (owner class isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] notNil ]
? -- Frank Church
======================= http://devblog.brahmancreations.com
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
TextMorphForEditView allInstances select: [:morph | morph firstOwnerSuchThat: [:owner | (owner class isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] notNil ] This code generates a syntax error. When I put the brackets where I think they should be I either get a NonBoolean receiver error or a True doesNotUndertstand value message/ -- Frank Church ======================= http://devblog.brahmancreations.com
On 01/09/2013 10:26 AM, Frank Church wrote:
TextMorphForEditView allInstances select: [:morph | morph firstOwnerSuchThat: [:owner | (owner class isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] notNil ]
Does this do what you want: TextMorphForEditView allInstances select: [ :morph | (morph firstOwnerSuchThat: [ :owner | (owner class isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]) notNil ]
On 9 January 2013 18:32, Paul DeBruicker <pdebruic@gmail.com> wrote:
TextMorphForEditView allInstances select: [ :morph | (morph firstOwnerSuchThat: [ :owner | (owner class isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]) notNil ]
When I print it returns an empty array #(), but I expect to get subset of TextMorphForEditView allInstances. What is the likely purpose of the notNil? -- Frank Church ======================= http://devblog.brahmancreations.com
On 01/09/2013 11:18 AM, Frank Church wrote:
When I print it returns an empty array #(), but I expect to get subset of TextMorphForEditView allInstances.
What is the likely purpose of the notNil?
-- Frank Church
The #firstOwnerSuchThat: method either returns the morph that meets the criteria specified in the block sent to it (in this instance that the owner is a SystemWindow and its model is a Workspace) or nil. The #select: block needs the code inside it to return a boolean, so the #notNil converts the response from the #firstOwnerSuchThat: method into a boolean rather than leaving it as either nil or the morph. If you right click on a method and choose Implementors you can see how each class that implements the method defines it. You can also right click the method and choose Senders to see examples of how the method is used.
On 9 January 2013 19:30, Paul DeBruicker <pdebruic@gmail.com> wrote:
On 01/09/2013 11:18 AM, Frank Church wrote:
When I print it returns an empty array #(), but I expect to get subset of TextMorphForEditView allInstances.
What is the likely purpose of the notNil?
-- Frank Church
The #firstOwnerSuchThat: method either returns the morph that meets the criteria specified in the block sent to it (in this instance that the owner is a SystemWindow and its model is a Workspace) or nil. The #select: block needs the code inside it to return a boolean, so the #notNil converts the response from the #firstOwnerSuchThat: method into a boolean rather than leaving it as either nil or the morph.
If you right click on a method and choose Implementors you can see how each class that implements the method defines it. You can also right click the method and choose Senders to see examples of how the method is used.
Is there some reason why the expression is returning an empty collection? Isn't the select: meant to return the whole list? -- Frank Church ======================= http://devblog.brahmancreations.com
Hi frank select: returns the elements that satisfy the argument. If none of them works -> #() (10 20 30) select: [:each | each > 100] -> #() what else could it be? Stef On Jan 9, 2013, at 9:39 PM, Frank Church wrote:
On 9 January 2013 19:30, Paul DeBruicker <pdebruic@gmail.com> wrote: On 01/09/2013 11:18 AM, Frank Church wrote:
When I print it returns an empty array #(), but I expect to get subset of TextMorphForEditView allInstances.
What is the likely purpose of the notNil?
-- Frank Church
The #firstOwnerSuchThat: method either returns the morph that meets the criteria specified in the block sent to it (in this instance that the owner is a SystemWindow and its model is a Workspace) or nil. The #select: block needs the code inside it to return a boolean, so the #notNil converts the response from the #firstOwnerSuchThat: method into a boolean rather than leaving it as either nil or the morph.
If you right click on a method and choose Implementors you can see how each class that implements the method defines it. You can also right click the method and choose Senders to see examples of how the method is used.
Is there some reason why the expression is returning an empty collection?
Isn't the select: meant to return the whole list?
-- Frank Church
======================= http://devblog.brahmancreations.com
On 01/09/2013 12:39 PM, Frank Church wrote:
On 9 January 2013 19:30, Paul DeBruicker <pdebruic@gmail.com <mailto:pdebruic@gmail.com>> wrote:
On 01/09/2013 11:18 AM, Frank Church wrote: > > When I print it returns an empty array #(), but I expect to get subset > of TextMorphForEditView allInstances. > > What is the likely purpose of the notNil? > > -- > Frank Church
The #firstOwnerSuchThat: method either returns the morph that meets the criteria specified in the block sent to it (in this instance that the owner is a SystemWindow and its model is a Workspace) or nil. The #select: block needs the code inside it to return a boolean, so the #notNil converts the response from the #firstOwnerSuchThat: method into a boolean rather than leaving it as either nil or the morph.
If you right click on a method and choose Implementors you can see how each class that implements the method defines it. You can also right click the method and choose Senders to see examples of how the method is used.
Is there some reason why the expression is returning an empty collection?
Isn't the select: meant to return the whole list?
No the #select: returns only those elements for which the select block returns true. The reason why you're getting an empty collection is because the select block for every element returns false. The criteria in the #firstOwnerSuchThat: block needs to be adjusted to be more permissive. Or the starting collection is wrong. In this instance its an issue of the criteria in the #firstOwnerSuchThat: block being wrong. This one you want is this: TextMorphForEditView allInstances select: [ :morph | (morph firstOwnerSuchThat: [ :owner | (owner isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]) notNil ] (I changed 'owner class isKindOf: SystemWindow' to 'owner isKindOf: SystemWindow') I'm on linux and you can shift-click (it may be option-click or commanc-click on other platforms I have no idea) the title bar of a Workspace and click 'explore' to see that workspace's instance variables. In the bottom pane of the explorer window you can test your select block's criteria to ensure it works for your desired objects. Another way to find a workspace is first close all windows then open a workspace and run Smalltalk garbageCollect then highlight the following, right click it, and choose 'explore' TextMorphForEditView allInstances The only thing in the array in the explorer window is the morph for the workspace. You can then start looking through the owners by clicking the triangle next to the #owner instance variable until you find one who's model is 'a Workspace'. That's the workspace object.
On 9 January 2013 21:08, Paul DeBruicker <pdebruic@gmail.com> wrote:
On 01/09/2013 12:39 PM, Frank Church wrote:
On 9 January 2013 19:30, Paul DeBruicker <pdebruic@gmail.com <mailto:pdebruic@gmail.com>> wrote:
On 01/09/2013 11:18 AM, Frank Church wrote: > > When I print it returns an empty array #(), but I expect to get
subset
> of TextMorphForEditView allInstances. > > What is the likely purpose of the notNil? > > -- > Frank Church
The #firstOwnerSuchThat: method either returns the morph that meets
the
criteria specified in the block sent to it (in this instance that the owner is a SystemWindow and its model is a Workspace) or nil. The #select: block needs the code inside it to return a boolean, so the #notNil converts the response from the #firstOwnerSuchThat: method
into
a boolean rather than leaving it as either nil or the morph.
If you right click on a method and choose Implementors you can see
how
each class that implements the method defines it. You can also right click the method and choose Senders to see examples of how the
method is
used.
Is there some reason why the expression is returning an empty
collection?
Isn't the select: meant to return the whole list?
No the #select: returns only those elements for which the select block returns true. The reason why you're getting an empty collection is because the select block for every element returns false. The criteria in the #firstOwnerSuchThat: block needs to be adjusted to be more permissive. Or the starting collection is wrong.
In this instance its an issue of the criteria in the #firstOwnerSuchThat: block being wrong.
This one you want is this:
TextMorphForEditView allInstances select: [ :morph | (morph firstOwnerSuchThat: [ :owner | (owner isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]) notNil ]
(I changed 'owner class isKindOf: SystemWindow' to 'owner isKindOf: SystemWindow')
I'm on linux and you can shift-click (it may be option-click or commanc-click on other platforms I have no idea) the title bar of a Workspace and click 'explore' to see that workspace's instance variables. In the bottom pane of the explorer window you can test your select block's criteria to ensure it works for your desired objects.
Another way to find a workspace is first close all windows then open a workspace and run
Smalltalk garbageCollect
then highlight the following, right click it, and choose 'explore'
TextMorphForEditView allInstances
The only thing in the array in the explorer window is the morph for the workspace. You can then start looking through the owners by clicking the triangle next to the #owner instance variable until you find one who's model is 'a Workspace'. That's the workspace object.
Thanks for the last answer which lists all the workspaces. My initial desire was to label my Workspaces and then copy the contents of those which match some label and organize them into a kind of collection. Similar to ScriptManager. So essentially I want to list all Workspaces whose titles or contents match a substring, parse the contents further for some criteria and put those matching into a list for review. Then from there put the right ones into a permanent persisted collection. My intention is to do something like. | workSpaces textMorphs | workSpaces := OrderedCollection new. textMorphs := TextMorphForEditView allInstances select: [ :morph | (morph firstOwnerSuchThat: [ :owner | (owner isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]) notNil ] I want to capture all the matching Workspaces into the workSpaces variable, by some method such as 'workSpaces[i] := textMorphs[i] getWorkspace' and get the labelString of the Workspace, but it seems that firstOwnerSuchThat returns a nil or notNil, rather than the actual Workspace and it also seems redundant to get the list of Workspaces into the workSpaces through iterating over the textMorphs variable as the owner variable in the loop captures them at some point. So this question breaks down into 2 parts. 1. How can copy add the owner if it turns out to be a Workspace to the workSpaces variable inside the loop (what is syntax) 2. How would I write a method such as : workSpace := textMorph getWorkspace, with or without using firstOwnerSuchThat, ie a general method of parsing the inheritance/ownership chain. -- Frank Church ======================= http://devblog.brahmancreations.com
On 01/10/2013 07:32 AM, Frank Church wrote:
Thanks for the last answer which lists all the workspaces.
My initial desire was to label my Workspaces and then copy the contents of those which match some label and organize them into a kind of collection. Similar to ScriptManager.
So essentially I want to list all Workspaces whose titles or contents match a substring, parse the contents further for some criteria and put those matching into a list for review. Then from there put the right ones into a permanent persisted collection.
My intention is to do something like.
| workSpaces textMorphs | workSpaces := OrderedCollection new. textMorphs := TextMorphForEditView allInstances select: [ :morph | (morph firstOwnerSuchThat: [ :owner | (owner isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]) notNil ]
I want to capture all the matching Workspaces into the workSpaces variable, by some method such as 'workSpaces[i] := textMorphs[i] getWorkspace' and get the labelString of the Workspace, but it seems that firstOwnerSuchThat returns a nil or notNil, rather than the actual Workspace and it also seems redundant to get the list of Workspaces into the workSpaces through iterating over the textMorphs variable as the owner variable in the loop captures them at some point.
So this question breaks down into 2 parts.
1. How can copy add the owner if it turns out to be a Workspace to the workSpaces variable inside the loop (what is syntax)
2. How would I write a method such as : workSpace := textMorph getWorkspace, with or without using firstOwnerSuchThat, ie a general method of parsing the inheritance/ownership chain.
I recommend you read through this: http://squeak.joyful.com/LanguageNotes 1. workSpaces:= TextMorphForEditView allInstances collect: [ :morph | (morph firstOwnerSuchThat: [ :owner | (owner isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]) notNil ] 2. TextMorph>>getWorkspace |workspace| workspace:= self firstOwnerSuchThat: [ :owner | (owner isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]. ^workspace Heres some for you: Why are you so resistant to using classes and so interested in using workspaces? Why invent a new way of using Smalltalk when you don't have the basics down pat? My point is you didn't know about #select: and you didn't know about #collect: but you do know that Workspaces are interesting and Classes and the Browser is not. Why not just put the contents of whatever you've got in the Workspaces into methods in a Classes you define and the you can call them whenever you want and persist them with the tools that have been developed thus far rather than inventing your own tooling while learning about Smalltalk..... Good luck Paul
So I'm an idiot. The answer to question 1 could be: workSpaces:= TextMorphForEditView allInstances select: [ :morph | (morph firstOwnerSuchThat: [ :owner | (owner isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]) notNil ] thenCollect:[:each | each]. workSpaces or: workSpaces:=OrderedCollection new. TextMorphForEditView allInstances do: [ :morph | (morph firstOwnerSuchThat: [ :owner | (owner isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]) notNil ifTrue:[workSpaces add: morph] ]. But the answer I gave to it earlier is definitely wrong as you just end up with a an array full of trues and falses. Sorry for leading you down the wrong path Paul On 01/10/2013 09:29 AM, Paul DeBruicker wrote:
On 01/10/2013 07:32 AM, Frank Church wrote:
Thanks for the last answer which lists all the workspaces.
My initial desire was to label my Workspaces and then copy the contents of those which match some label and organize them into a kind of collection. Similar to ScriptManager.
So essentially I want to list all Workspaces whose titles or contents match a substring, parse the contents further for some criteria and put those matching into a list for review. Then from there put the right ones into a permanent persisted collection.
My intention is to do something like.
| workSpaces textMorphs | workSpaces := OrderedCollection new. textMorphs := TextMorphForEditView allInstances select: [ :morph | (morph firstOwnerSuchThat: [ :owner | (owner isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]) notNil ]
I want to capture all the matching Workspaces into the workSpaces variable, by some method such as 'workSpaces[i] := textMorphs[i] getWorkspace' and get the labelString of the Workspace, but it seems that firstOwnerSuchThat returns a nil or notNil, rather than the actual Workspace and it also seems redundant to get the list of Workspaces into the workSpaces through iterating over the textMorphs variable as the owner variable in the loop captures them at some point.
So this question breaks down into 2 parts.
1. How can copy add the owner if it turns out to be a Workspace to the workSpaces variable inside the loop (what is syntax)
2. How would I write a method such as : workSpace := textMorph getWorkspace, with or without using firstOwnerSuchThat, ie a general method of parsing the inheritance/ownership chain.
I recommend you read through this:
http://squeak.joyful.com/LanguageNotes
1.
workSpaces:=
TextMorphForEditView allInstances collect: [ :morph | (morph firstOwnerSuchThat: [ :owner | (owner isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]) notNil ]
2.
TextMorph>>getWorkspace |workspace| workspace:= self firstOwnerSuchThat: [ :owner | (owner isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]. ^workspace
Heres some for you:
Why are you so resistant to using classes and so interested in using workspaces? Why invent a new way of using Smalltalk when you don't have the basics down pat? My point is you didn't know about #select: and you didn't know about #collect: but you do know that Workspaces are interesting and Classes and the Browser is not. Why not just put the contents of whatever you've got in the Workspaces into methods in a Classes you define and the you can call them whenever you want and persist them with the tools that have been developed thus far rather than inventing your own tooling while learning about Smalltalk.....
Good luck
Paul
On 10 January 2013 18:29, Paul DeBruicker <pdebruic@gmail.com> wrote:
On 01/10/2013 07:32 AM, Frank Church wrote:
Thanks for the last answer which lists all the workspaces.
My initial desire was to label my Workspaces and then copy the contents of those which match some label and organize them into a kind of collection. Similar to ScriptManager.
So essentially I want to list all Workspaces whose titles or contents match a substring, parse the contents further for some criteria and put those matching into a list for review. Then from there put the right ones into a permanent persisted collection.
My intention is to do something like.
| workSpaces textMorphs | workSpaces := OrderedCollection new. textMorphs := TextMorphForEditView allInstances select: [ :morph | (morph firstOwnerSuchThat: [ :owner | (owner isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]) notNil ]
I want to capture all the matching Workspaces into the workSpaces variable, by some method such as 'workSpaces[i] := textMorphs[i] getWorkspace' and get the labelString of the Workspace, but it seems that firstOwnerSuchThat returns a nil or notNil, rather than the actual Workspace and it also seems redundant to get the list of Workspaces into the workSpaces through iterating over the textMorphs variable as the owner variable in the loop captures them at some point.
So this question breaks down into 2 parts.
1. How can copy add the owner if it turns out to be a Workspace to the workSpaces variable inside the loop (what is syntax)
2. How would I write a method such as : workSpace := textMorph getWorkspace, with or without using firstOwnerSuchThat, ie a general method of parsing the inheritance/ownership chain.
I recommend you read through this:
http://squeak.joyful.com/LanguageNotes
1.
workSpaces:=
TextMorphForEditView allInstances collect: [ :morph | (morph firstOwnerSuchThat: [ :owner | (owner isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]) notNil ]
2.
TextMorph>>getWorkspace |workspace| workspace:= self firstOwnerSuchThat: [ :owner | (owner isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]. ^workspace
Heres some for you:
Why are you so resistant to using classes and so interested in using workspaces? Why invent a new way of using Smalltalk when you don't have the basics down pat? My point is you didn't know about #select: and you didn't know about #collect: but you do know that Workspaces are interesting and Classes and the Browser is not. Why not just put the contents of whatever you've got in the Workspaces into methods in a Classes you define and the you can call them whenever you want and persist them with the tools that have been developed thus far rather than inventing your own tooling while learning about Smalltalk.....
indeed. I wonder why you (Frank) need such complicated way for doing things. If you need a reusable piece of code, which you want to use more than 1 time, classes is the best placeholder for them.. Even if you put things at class side, it helps a lot.. so then you can just type: MyUtilsClass doThis MyUtilsClass doThat etc
Good luck
Paul
-- Best regards, Igor Stasenko.
On 10 January 2013 19:31, Igor Stasenko <siguctua@gmail.com> wrote:
On 10 January 2013 18:29, Paul DeBruicker <pdebruic@gmail.com> wrote:
On 01/10/2013 07:32 AM, Frank Church wrote:
Thanks for the last answer which lists all the workspaces.
My initial desire was to label my Workspaces and then copy the contents of those which match some label and organize them into a kind of collection. Similar to ScriptManager.
So essentially I want to list all Workspaces whose titles or contents match a substring, parse the contents further for some criteria and put those matching into a list for review. Then from there put the right ones into a permanent persisted collection.
My intention is to do something like.
| workSpaces textMorphs | workSpaces := OrderedCollection new. textMorphs := TextMorphForEditView allInstances select: [ :morph | (morph firstOwnerSuchThat: [ :owner | (owner isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]) notNil ]
I want to capture all the matching Workspaces into the workSpaces variable, by some method such as 'workSpaces[i] := textMorphs[i] getWorkspace' and get the labelString of the Workspace, but it seems that firstOwnerSuchThat returns a nil or notNil, rather than the actual Workspace and it also seems redundant to get the list of Workspaces into the workSpaces through iterating over the textMorphs variable as the owner variable in the loop captures them at some point.
So this question breaks down into 2 parts.
1. How can copy add the owner if it turns out to be a Workspace to the workSpaces variable inside the loop (what is syntax)
2. How would I write a method such as : workSpace := textMorph getWorkspace, with or without using firstOwnerSuchThat, ie a general method of parsing the inheritance/ownership chain.
I recommend you read through this:
http://squeak.joyful.com/LanguageNotes
1.
workSpaces:=
TextMorphForEditView allInstances collect: [ :morph | (morph firstOwnerSuchThat: [ :owner | (owner isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]) notNil ]
2.
TextMorph>>getWorkspace |workspace| workspace:= self firstOwnerSuchThat: [ :owner | (owner isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]. ^workspace
Heres some for you:
Why are you so resistant to using classes and so interested in using workspaces? Why invent a new way of using Smalltalk when you don't have the basics down pat? My point is you didn't know about #select: and you didn't know about #collect: but you do know that Workspaces are interesting and Classes and the Browser is not. Why not just put the contents of whatever you've got in the Workspaces into methods in a Classes you define and the you can call them whenever you want and persist them with the tools that have been developed thus far rather than inventing your own tooling while learning about Smalltalk.....
indeed. I wonder why you (Frank) need such complicated way for doing things. If you need a reusable piece of code, which you want to use more than 1 time, classes is the best placeholder for them..
Even if you put things at class side, it helps a lot.. so then you can just type:
MyUtilsClass doThis
MyUtilsClass doThat
etc
Good luck
Paul
-- Best regards, Igor Stasenko.
Hi Igor, I am new to Smalltalk but not new to programming and I am into my first 14 hrs into learning it with Pharo. As I was trying to work out the right syntax it brought to mind the thoughts of Brendan Eich, Gilad Bracha and Lars Bak who said the familar syntax (Algol/C style) of languages like Javascript, Go and Dart was chosen to make it easier for programmers familiar with C, Pascal etcetera to starting using. them, rather than learn a whole new paradigm, even at the cost of complicated parsing and language structure. If I was using Eclipse IDE for instance, at every step I could use auto-completion and the documentation to decide what follows from what, even in a domain I had no familiarity with, but Smalltalk doesn't lend itself to that approach. With spoken languages even without proper syntax or phrasing a person who knows the language can deduce what you are trying to say but with computers you either get it right or the computer stares back at you blankly. As an experienced programmer I am trying to accomplish something non-trivial as hard and as fast as I can with Squeak, Pharo and their supporting libraries and ecosystem and the only way is to bombard the mailing lists and forums. You could say I am trying to understand how the language constructs can support my intentions as fast as I can.
Heres some for you:
Why are you so resistant to using classes and so interested in using workspaces? Why invent a new way of using Smalltalk when you don't have the basics down pat? My point is you didn't know about #select: and you didn't know about #collect: but you do know that Workspaces are interesting and Classes and the Browser is not. Why not just put the contents of whatever you've got in the Workspaces into methods in a Classes you define and the you can call them whenever you want and persist them with the tools that have been developed thus far rather than inventing your own tooling while learning about Smalltalk.....
indeed. I wonder why you (Frank) need such complicated way for doing things. If you need a reusable piece of code, which you want to use more than 1 time, classes is the best placeholder for them..
Even if you put things at class side, it helps a lot.. so then you can just type:
MyUtilsClass doThis
MyUtilsClass doThat
etc
Good luck
With respect to the above I can truthfully say that at this juncture I don't know what it all means, from the theoretical view point, nor from the practical perspective of what I am trying to accomplish, which is why the questions are flying in so thick and fast. For instance yesterday I was thinking as to why the types/classes of the instance variables was not specified when I defined a class, in the way I would with Object Pascal and Java classes or record types, then it dawned on me that perhaps their getters and setters, together with other methods defined on them would define what in other languages would be their type. Thus it results in better understanding of the notion that in Smalltalk everything is an object and the methods it supports more or less defines its "type" Another thing - the topic of this thread is not so much concerned with Workspaces. I am more interested in scanning the workspace for any control capable of text editing and extracting the text from it. Workspaces are the first instance one comes across, and shift-clicking the editing area resulted in a TextMorphForEditView. So to do what I want I have to create a new kind of editing widget with TextMorphForEditView embedded it in it, or find an existing one and use/learn from/adapt it. In fact it is linked to SO 5592521 Last of all - teachers please, I don't want to go to Smalltalk kindergarten. I have done too much programming in my life to be put in kindergarten when I start Smalltalk. The problem here is although one can learn from reading examples, it can be hard to understand the language constructs unless they are derived from one's own use cases, and this is why my questions have been coming in so thick and fast. PS. The Stack Overflow ranking of a lot of expert Smalltalkers has an inverse relationship to their expertise, a notable exception being Frank Shearer (related to the footballer?) ;-) -- Frank Church ======================= http://devblog.brahmancreations.com
PS. The Stack Overflow ranking of a lot of expert Smalltalkers has an inverse relationship to their expertise, a notable exception being Frank Shearer (related to the footballer?) ;-)
@Frank, sorry about the mix up, yours has an 'a' not an 'e' at the end. I think it is nice to be associated with a famous footballer though. -- Frank Church ======================= http://devblog.brahmancreations.com
As an experienced programmer I am trying to accomplish something non-trivial as hard and as fast as I can with Squeak, Pharo and their supporting libraries and ecosystem and the only way is to bombard the mailing lists and forums. You could say I am trying to understand how the language constructs can support my intentions as fast as I can.
sure there is no problem. Now understanding the culture is important. Because if writing scripts would be so important for us we would have something else than a workspace. Usually I turned into a method a script **AS FAST AS** I can. Because I can reuse it.
For instance yesterday I was thinking as to why the types/classes of the instance variables was not specified when I defined a class, in the way I would with Object Pascal and Java classes or record types, then it dawned on me that perhaps their getters and setters, together with other methods defined on them would define what in other languages would be their type. Thus it results in better understanding of the notion that in Smalltalk everything is an object and the methods it supports more or less defines its "type"
Another thing - the topic of this thread is not so much concerned with Workspaces. I am more interested in scanning the workspace for any control capable of text editing and extracting the text from it. Workspaces are the first instance one comes across, and shift-clicking the editing area resulted in a TextMorphForEditView. So to do what I want I have to create a new kind of editing widget with TextMorphForEditView embedded it in it, or find an existing one and use/learn from/adapt it. In fact it is linked to SO 5592521
rigth now we are not happy with the state of the texteditor in Pharo We are starting to redesign it from scratch.
Last of all - teachers please, I don't want to go to Smalltalk kindergarten. I have done too much programming in my life to be put in kindergarten when I start Smalltalk. The problem here is although one can learn from reading examples, it can be hard to understand the language constructs unless they are derived from one's own use cases, and this is why my questions have been coming in so thick and fast.
No problem with questions. About the syntax have a look at one of the chapter of Pharo by example.
PS. The Stack Overflow ranking of a lot of expert Smalltalkers has an inverse relationship to their expertise, a notable exception being Frank Shearer (related to the footballer?) ;-)
Indeed we are problem to get unstuck from our mailing-list :)
-- Frank Church
======================= http://devblog.brahmancreations.com
Frank Church wrote:
Hi Igor,
I am new to Smalltalk but not new to programming and I am into my first 14 hrs into learning it with Pharo.
Good to have you on board Frank. It will be interesting to follow your experience in becoming proficient in Smalltalk & Pharo. I am just coming up on a year of using Smalltalk/Pharo. There are a lot of hidden depths and I learn a lot watching the mail list for answers to questions that I hadn't thought of asking yet. So fire away. I'll just mention a few things that I have learned that make it easier to plumb the system for examples. Also see http://marianopeck.wordpress.com/2012/05/19/pharo-tips-and-tricks/
As I was trying to work out the right syntax it brought to mind the thoughts of Brendan Eich, Gilad Bracha and Lars Bak who said the familar syntax (Algol/C style) of languages like Javascript, Go and Dart was chosen to make it easier for programmers familiar with C, Pascal etcetera to starting using. them, rather than learn a whole new paradigm, even at the cost of complicated parsing and language structure.
The flipside is that it makes it easier to continue operating with your old paradigms in a hybrid manner, preventing you gaining the most 'stretch' most from a new paradigm. That is a very personal choice depending on what you want to gain from new learnings. However the main paradigm shift of Smalltalk is not its syntax but its 'live environment'.
If I was using Eclipse IDE for instance, at every step I could use auto-completion and the documentation to decide what follows from what, even in a domain I had no familiarity with, but Smalltalk doesn't lend itself to that approach.
I was going to just ask for some examples of what you particularly liked in Eclipse. We can learn from other systems. However with a quick browse I found [1]. Do you have anything to add to that? [1] http://eclipse.org/recommenders/documentation/usr.html A few thoughts in response... _Intelligent Code Templates_ - "But code templates /really/ shine when developers have to use APIs they are not very familiar with. Then, code templates serve as additional documentation that quickly shows how an API can be used and save developers lot of time otherwise needed for reading API documentation. Eclipse maintains more than 70 of such Java code templates" Within Smalltalk, rather than 70 templates you have the whole system. If you are browsing a class and see a method which seems like what you want, click <Senders> to get an idea of how to use them. Another way to learn the system is to temporarily edit any method to insert a 'self haltOnce' then 'World-menu > System > Enable halt/inspect once' which will bring up a debugger where you can explore the call chain to see a live demonstration of how that method is used. The reason to use #haltOnce rather than #halt is that method might be used by the display system and you wold end up locking the image with cascading halts as the display loop runs. Using halos, you can <Duplicate> that menu item and leave it sitting on the background as a button for easy access. You can highlight any method and use <cmd-n> or <cmd-m> to get a list of senders & implementors of that method. I often find myself following several levels to understand a chain of calls. Learn the difference in using the <Into> <Over>& <Through> buttons when debugging (eg from the Workspace context menu) something like '#(1 2 3 4) do: [ :x | Transcript crShow: x].' For quite a while I had missed using <Through> properly which hamstrung me when tracing code and not wanting to trace the machinery of how #do: worked. _Intelligent Overrides Completion_ & _Subclassing Directives_ & _Self-call Directives_ These look interesting, in particular if they bought up examples from public repositories outside the image.
With spoken languages even without proper syntax or phrasing a person who knows the language can deduce what you are trying to say but with computers you either get it right or the computer stares back at you blankly.
As an experienced programmer I am trying to accomplish something non-trivial as hard and as fast as I can with Squeak, Pharo and their supporting libraries and ecosystem and the only way is to bombard the mailing lists and forums. You could say I am trying to understand how the language constructs can support my intentions as fast as I can.
With respect to the above I can truthfully say that at this juncture I don't know what it all means, from the theoretical view point, nor from the practical perspective of what I am trying to accomplish, which is why the questions are flying in so thick and fast.
Last of all - teachers please, I don't want to go to Smalltalk kindergarten. I have done too much programming in my life to be put in kindergarten when I start Smalltalk. The problem here is although one can learn from reading examples, it can be hard to understand the language constructs unless they are derived from one's own use cases, and this is why my questions have been coming in so thick and fast.
Even in light of that wanting to use your own use cases, there is one example I would recommend [2] - since it is the best demonstration I've seen of the paradigm shift of programming in Squeak/Pharo's live environment. It is not entirely trivial - it took me a couple of days to get through it - but the main reason I recommend it is that it is more than a code example. It is a demonstration the power of the system to refactor as the design evolves from concept to deployment. The author exposes errors in design and how best to use the debugger. Kind of a "this is how things are done in Smalltalk". YMMV but I personally found it useful to help me change my approach from previous programming languages. It is actually one of the main things that mad me focus more on Smalltalk. You would need to temporarily regress a few years to use Squeak 3.9 to match the article, then come back to use the latest and greatest in current Pharo. [2] http://squeak.preeminent.org/tut2007/html/index.html cheers -ben
On Jan 12, 2013, at 1:19 AM, Ben Coman <btc@openInWorld.com> wrote:
Frank Church wrote:
Hi Igor,
I am new to Smalltalk but not new to programming and I am into my first 14 hrs into learning it with Pharo.
Good to have you on board Frank. It will be interesting to follow your experience in becoming proficient in Smalltalk & Pharo. I am just coming up on a year of using Smalltalk/Pharo. There are a lot of hidden depths and I learn a lot watching the mail list for answers to questions that I hadn't thought of asking yet. So fire away.
Yes, and we really need to fix all the small hurdles people encounter⦠and improve the documentation for people not already knowing things.. Marcus
Hi everyone, I was checking the NativeBoost code and I am confused with some heap allocation procedures, specifically: NBFFICallout>>resolveType: "It receives a type name aTypeName" ... "name becomes an alias for aTypeName" binding := resolver nbBindingOf: name asSymbol. binding ifNotNil: [ ^ (binding value asNBExternalType: self) pointerArity: ptrArity ] . Is there anybody who can help me solving an issue I have found 2013/1/12 Marcus Denker <marcus.denker@inria.fr>
On Jan 12, 2013, at 1:19 AM, Ben Coman <btc@openInWorld.com> wrote:
Frank Church wrote:
Hi Igor,
I am new to Smalltalk but not new to programming and I am into my first 14 hrs into learning it with Pharo.
Good to have you on board Frank. It will be interesting to follow your experience in becoming proficient in Smalltalk & Pharo. I am just coming up on a year of using Smalltalk/Pharo. There are a lot of hidden depths and I learn a lot watching the mail list for answers to questions that I hadn't thought of asking yet. So fire away.
Yes, and we really need to fix all the small hurdles people encounter⦠and improve the documentation for people not already knowing things..
Marcus
On 12 January 2013 03:03, Jesus Nuñez <poissonbreaker@gmail.com> wrote:
Hi everyone,
I was checking the NativeBoost code and I am confused with some heap allocation procedures, specifically:
NBFFICallout>>resolveType: "It receives a type name aTypeName" ... "name becomes an alias for aTypeName"
binding := resolver nbBindingOf: name asSymbol. binding ifNotNil: [ ^ (binding value asNBExternalType: self) pointerArity: ptrArity ] .
Is there anybody who can help me solving an issue I have found
Hi, Jesus. If you install NativeBoost-Help package , there is a detailed description what happens there. Gofer it squeaksource: 'NativeBoost'; package:'NativeBoost-Help'; load. then: NBHelp open. Look for FFI -> Type system -> Step 2 . Resolving types (if 'NBHelp open.' won't work for some reason, you can still find that page in NBHelpOnFFI class. But i did some last-minute checks, it should work fine in Pharo 2.0 images ) -- Best regards, Igor Stasenko.
Hi jesus please open a new thread! Stef On Jan 12, 2013, at 3:03 AM, Jesus Nuñez wrote:
Hi everyone,
I was checking the NativeBoost code and I am confused with some heap allocation procedures, specifically:
NBFFICallout>>resolveType: "It receives a type name aTypeName" ... "name becomes an alias for aTypeName"
binding := resolver nbBindingOf: name asSymbol.
binding ifNotNil: [ ^ (binding value asNBExternalType: self) pointerArity: ptrArity ] .
Is there anybody who can help me solving an issue I have found
2013/1/12 Marcus Denker <marcus.denker@inria.fr>
On Jan 12, 2013, at 1:19 AM, Ben Coman <btc@openInWorld.com> wrote:
Frank Church wrote:
Hi Igor,
I am new to Smalltalk but not new to programming and I am into my first 14 hrs into learning it with Pharo.
Good to have you on board Frank. It will be interesting to follow your experience in becoming proficient in Smalltalk & Pharo. I am just coming up on a year of using Smalltalk/Pharo. There are a lot of hidden depths and I learn a lot watching the mail list for answers to questions that I hadn't thought of asking yet. So fire away.
Yes, and we really need to fix all the small hurdles people encounter⦠and improve the documentation for people not already knowing things..
Marcus
Hi everyone, I was checking the NativeBoost code and I am confused with some heap allocation procedures, specifically: NBFFICallout>>resolveType: "It receives a type name aTypeName" ... "name becomes an alias for aTypeName" ... binding := resolver nbBindingOf: name asSymbol. !!!!Why is this here??? It checks for the binding of a type?? binding ifNotNil: [ ^ (binding value asNBExternalType: self) pointerArity: ptrArity ] . Is there anybody who can help me with this?, I think the semantic is wrong here or am I missing something?? Regards, Jesus Nuñez 2013/1/12 Marcus Denker <marcus.denker@inria.fr>
On Jan 12, 2013, at 1:19 AM, Ben Coman <btc@openInWorld.com> wrote:
Frank Church wrote:
Hi Igor,
I am new to Smalltalk but not new to programming and I am into my first 14 hrs into learning it with Pharo.
Good to have you on board Frank. It will be interesting to follow your experience in becoming proficient in Smalltalk & Pharo. I am just coming up on a year of using Smalltalk/Pharo. There are a lot of hidden depths and I learn a lot watching the mail list for answers to questions that I hadn't thought of asking yet. So fire away.
Yes, and we really need to fix all the small hurdles people encounter⦠and improve the documentation for people not already knowing things..
Marcus
Sorry for the misleading term of "heap allocation procedures", better call it a piece of code :) 2013/1/12 Jesus Nuñez <poissonbreaker@gmail.com>
Hi everyone,
I was checking the NativeBoost code and I am confused with some heap allocation procedures, specifically:
NBFFICallout>>resolveType: "It receives a type name aTypeName" ... "name becomes an alias for aTypeName" ... binding := resolver nbBindingOf: name asSymbol. !!!!Why is this here??? It checks for the binding of a type?? binding ifNotNil: [ ^ (binding value asNBExternalType: self) pointerArity: ptrArity ] .
Is there anybody who can help me with this?, I think the semantic is wrong here or am I missing something??
Regards,
Jesus Nuñez
2013/1/12 Marcus Denker <marcus.denker@inria.fr>
On Jan 12, 2013, at 1:19 AM, Ben Coman <btc@openInWorld.com> wrote:
Frank Church wrote:
Hi Igor,
I am new to Smalltalk but not new to programming and I am into my first 14 hrs into learning it with Pharo.
Good to have you on board Frank. It will be interesting to follow your experience in becoming proficient in Smalltalk & Pharo. I am just coming up on a year of using Smalltalk/Pharo. There are a lot of hidden depths and I learn a lot watching the mail list for answers to questions that I hadn't thought of asking yet. So fire away.
Yes, and we really need to fix all the small hurdles people encounter⦠and improve the documentation for people not already knowing things..
Marcus
Hello again, I think my problem is that I upgraded NativeCode and it can not handle some types, It prompts an error as: "unable to revolve external type: int", I ran a piece of code that was working before and it also failed. I stay with the older version so please ignore my question. 2013/1/12 Jesus Nuñez <poissonbreaker@gmail.com>
Sorry for the misleading term of "heap allocation procedures", better call it a piece of code :)
2013/1/12 Jesus Nuñez <poissonbreaker@gmail.com>
Hi everyone,
I was checking the NativeBoost code and I am confused with some heap allocation procedures, specifically:
NBFFICallout>>resolveType: "It receives a type name aTypeName" ... "name becomes an alias for aTypeName" ... binding := resolver nbBindingOf: name asSymbol. !!!!Why is this here??? It checks for the binding of a type?? binding ifNotNil: [ ^ (binding value asNBExternalType: self) pointerArity: ptrArity ] .
Is there anybody who can help me with this?, I think the semantic is wrong here or am I missing something??
Regards,
Jesus Nuñez
2013/1/12 Marcus Denker <marcus.denker@inria.fr>
On Jan 12, 2013, at 1:19 AM, Ben Coman <btc@openInWorld.com> wrote:
Frank Church wrote:
Hi Igor,
I am new to Smalltalk but not new to programming and I am into my first 14 hrs into learning it with Pharo.
Good to have you on board Frank. It will be interesting to follow your experience in becoming proficient in Smalltalk & Pharo. I am just coming up on a year of using Smalltalk/Pharo. There are a lot of hidden depths and I learn a lot watching the mail list for answers to questions that I hadn't thought of asking yet. So fire away.
Yes, and we really need to fix all the small hurdles people encounter⦠and improve the documentation for people not already knowing things..
Marcus
On 12 January 2013 03:43, Jesus Nuñez <poissonbreaker@gmail.com> wrote:
Hello again, I think my problem is that I upgraded NativeCode and it can not handle some types, It prompts an error as: "unable to revolve external type: int", I ran a piece of code that was working before and it also failed. I stay with the older version so please ignore my question.
Hmm.. there is no such class in NativeBoost. Perhaps you meant NBFFICallout? Try do NBFFICallout initialize. to see if it will fix the problem.
2013/1/12 Jesus Nuñez <poissonbreaker@gmail.com>
Sorry for the misleading term of "heap allocation procedures", better call it a piece of code :)
2013/1/12 Jesus Nuñez <poissonbreaker@gmail.com>
Hi everyone,
I was checking the NativeBoost code and I am confused with some heap allocation procedures, specifically:
NBFFICallout>>resolveType: "It receives a type name aTypeName" ... "name becomes an alias for aTypeName" ... binding := resolver nbBindingOf: name asSymbol. !!!!Why is this here??? It checks for the binding of a type?? binding ifNotNil: [ ^ (binding value asNBExternalType: self) pointerArity: ptrArity ] .
Is there anybody who can help me with this?, I think the semantic is wrong here or am I missing something??
Regards,
Jesus Nuñez
2013/1/12 Marcus Denker <marcus.denker@inria.fr>
On Jan 12, 2013, at 1:19 AM, Ben Coman <btc@openInWorld.com> wrote:
Frank Church wrote:
Hi Igor,
I am new to Smalltalk but not new to programming and I am into my first 14 hrs into learning it with Pharo.
Good to have you on board Frank. It will be interesting to follow your experience in becoming proficient in Smalltalk & Pharo. I am just coming up on a year of using Smalltalk/Pharo. There are a lot of hidden depths and I learn a lot watching the mail list for answers to questions that I hadn't thought of asking yet. So fire away.
Yes, and we really need to fix all the small hurdles people encounter⦠and improve the documentation for people not already knowing things..
Marcus
-- Best regards, Igor Stasenko.
Guys We love all your ideas and feedback. Now do you have an idea of the ratio Intelligent vs Pharo Eclispe vs Pharo in terms of payed engineering time? Stef On Jan 12, 2013, at 1:19 AM, Ben Coman wrote:
Frank Church wrote:
Hi Igor,
I am new to Smalltalk but not new to programming and I am into my first 14 hrs into learning it with Pharo.
Good to have you on board Frank. It will be interesting to follow your experience in becoming proficient in Smalltalk & Pharo. I am just coming up on a year of using Smalltalk/Pharo. There are a lot of hidden depths and I learn a lot watching the mail list for answers to questions that I hadn't thought of asking yet. So fire away. I'll just mention a few things that I have learned that make it easier to plumb the system for examples. Also see http://marianopeck.wordpress.com/2012/05/19/pharo-tips-and-tricks/
As I was trying to work out the right syntax it brought to mind the thoughts of Brendan Eich, Gilad Bracha and Lars Bak who said the familar syntax (Algol/C style) of languages like Javascript, Go and Dart was chosen to make it easier for programmers familiar with C, Pascal etcetera to starting using. them, rather than learn a whole new paradigm, even at the cost of complicated parsing and language structure.
The flipside is that it makes it easier to continue operating with your old paradigms in a hybrid manner, preventing you gaining the most 'stretch' most from a new paradigm. That is a very personal choice depending on what you want to gain from new learnings. However the main paradigm shift of Smalltalk is not its syntax but its 'live environment'.
If I was using Eclipse IDE for instance, at every step I could use auto-completion and the documentation to decide what follows from what, even in a domain I had no familiarity with, but Smalltalk doesn't lend itself to that approach.
I was going to just ask for some examples of what you particularly liked in Eclipse. We can learn from other systems. However with a quick browse I found [1]. Do you have anything to add to that? [1] http://eclipse.org/recommenders/documentation/usr.html
A few thoughts in response...
_Intelligent Code Templates_ - "But code templates /really/ shine when developers have to use APIs they are not very familiar with. Then, code templates serve as additional documentation that quickly shows how an API can be used and save developers lot of time otherwise needed for reading API documentation. Eclipse maintains more than 70 of such Java code templates"
Within Smalltalk, rather than 70 templates you have the whole system. If you are browsing a class and see a method which seems like what you want, click <Senders> to get an idea of how to use them. Another way to learn the system is to temporarily edit any method to insert a 'self haltOnce' then 'World-menu > System > Enable halt/inspect once' which will bring up a debugger where you can explore the call chain to see a live demonstration of how that method is used. The reason to use #haltOnce rather than #halt is that method might be used by the display system and you wold end up locking the image with cascading halts as the display loop runs. Using halos, you can <Duplicate> that menu item and leave it sitting on the background as a button for easy access.
You can highlight any method and use <cmd-n> or <cmd-m> to get a list of senders & implementors of that method. I often find myself following several levels to understand a chain of calls.
Learn the difference in using the <Into> <Over>& <Through> buttons when debugging (eg from the Workspace context menu) something like '#(1 2 3 4) do: [ :x | Transcript crShow: x].' For quite a while I had missed using <Through> properly which hamstrung me when tracing code and not wanting to trace the machinery of how #do: worked.
_Intelligent Overrides Completion_ & _Subclassing Directives_ & _Self-call Directives_ These look interesting, in particular if they bought up examples from public repositories outside the image.
With spoken languages even without proper syntax or phrasing a person who knows the language can deduce what you are trying to say but with computers you either get it right or the computer stares back at you blankly.
As an experienced programmer I am trying to accomplish something non-trivial as hard and as fast as I can with Squeak, Pharo and their supporting libraries and ecosystem and the only way is to bombard the mailing lists and forums. You could say I am trying to understand how the language constructs can support my intentions as fast as I can.
With respect to the above I can truthfully say that at this juncture I don't know what it all means, from the theoretical view point, nor from the practical perspective of what I am trying to accomplish, which is why the questions are flying in so thick and fast.
Last of all - teachers please, I don't want to go to Smalltalk kindergarten. I have done too much programming in my life to be put in kindergarten when I start Smalltalk. The problem here is although one can learn from reading examples, it can be hard to understand the language constructs unless they are derived from one's own use cases, and this is why my questions have been coming in so thick and fast.
Even in light of that wanting to use your own use cases, there is one example I would recommend [2] - since it is the best demonstration I've seen of the paradigm shift of programming in Squeak/Pharo's live environment. It is not entirely trivial - it took me a couple of days to get through it - but the main reason I recommend it is that it is more than a code example. It is a demonstration the power of the system to refactor as the design evolves from concept to deployment. The author exposes errors in design and how best to use the debugger. Kind of a "this is how things are done in Smalltalk". YMMV but I personally found it useful to help me change my approach from previous programming languages. It is actually one of the main things that mad me focus more on Smalltalk. You would need to temporarily regress a few years to use Squeak 3.9 to match the article, then come back to use the latest and greatest in current Pharo.
[2] http://squeak.preeminent.org/tut2007/html/index.html
cheers -ben
On 12 Jan 2013, at 09:28, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Guys
We love all your ideas and feedback. Now do you have an idea of the ratio Intelligent vs Pharo Eclispe vs Pharo in terms of payed engineering time?
Yes, but we work in the best environment in the world with enthusiasm, love and passion, that is our secret weapon ;-)
Stef
On Jan 12, 2013, at 1:19 AM, Ben Coman wrote:
Frank Church wrote:
Hi Igor,
I am new to Smalltalk but not new to programming and I am into my first 14 hrs into learning it with Pharo.
Good to have you on board Frank. It will be interesting to follow your experience in becoming proficient in Smalltalk & Pharo. I am just coming up on a year of using Smalltalk/Pharo. There are a lot of hidden depths and I learn a lot watching the mail list for answers to questions that I hadn't thought of asking yet. So fire away. I'll just mention a few things that I have learned that make it easier to plumb the system for examples. Also see http://marianopeck.wordpress.com/2012/05/19/pharo-tips-and-tricks/
As I was trying to work out the right syntax it brought to mind the thoughts of Brendan Eich, Gilad Bracha and Lars Bak who said the familar syntax (Algol/C style) of languages like Javascript, Go and Dart was chosen to make it easier for programmers familiar with C, Pascal etcetera to starting using. them, rather than learn a whole new paradigm, even at the cost of complicated parsing and language structure.
The flipside is that it makes it easier to continue operating with your old paradigms in a hybrid manner, preventing you gaining the most 'stretch' most from a new paradigm. That is a very personal choice depending on what you want to gain from new learnings. However the main paradigm shift of Smalltalk is not its syntax but its 'live environment'.
If I was using Eclipse IDE for instance, at every step I could use auto-completion and the documentation to decide what follows from what, even in a domain I had no familiarity with, but Smalltalk doesn't lend itself to that approach.
I was going to just ask for some examples of what you particularly liked in Eclipse. We can learn from other systems. However with a quick browse I found [1]. Do you have anything to add to that? [1] http://eclipse.org/recommenders/documentation/usr.html
A few thoughts in response...
_Intelligent Code Templates_ - "But code templates /really/ shine when developers have to use APIs they are not very familiar with. Then, code templates serve as additional documentation that quickly shows how an API can be used and save developers lot of time otherwise needed for reading API documentation. Eclipse maintains more than 70 of such Java code templates"
Within Smalltalk, rather than 70 templates you have the whole system. If you are browsing a class and see a method which seems like what you want, click <Senders> to get an idea of how to use them. Another way to learn the system is to temporarily edit any method to insert a 'self haltOnce' then 'World-menu > System > Enable halt/inspect once' which will bring up a debugger where you can explore the call chain to see a live demonstration of how that method is used. The reason to use #haltOnce rather than #halt is that method might be used by the display system and you wold end up locking the image with cascading halts as the display loop runs. Using halos, you can <Duplicate> that menu item and leave it sitting on the background as a button for easy access.
You can highlight any method and use <cmd-n> or <cmd-m> to get a list of senders & implementors of that method. I often find myself following several levels to understand a chain of calls.
Learn the difference in using the <Into> <Over>& <Through> buttons when debugging (eg from the Workspace context menu) something like '#(1 2 3 4) do: [ :x | Transcript crShow: x].' For quite a while I had missed using <Through> properly which hamstrung me when tracing code and not wanting to trace the machinery of how #do: worked.
_Intelligent Overrides Completion_ & _Subclassing Directives_ & _Self-call Directives_ These look interesting, in particular if they bought up examples from public repositories outside the image.
With spoken languages even without proper syntax or phrasing a person who knows the language can deduce what you are trying to say but with computers you either get it right or the computer stares back at you blankly.
As an experienced programmer I am trying to accomplish something non-trivial as hard and as fast as I can with Squeak, Pharo and their supporting libraries and ecosystem and the only way is to bombard the mailing lists and forums. You could say I am trying to understand how the language constructs can support my intentions as fast as I can.
With respect to the above I can truthfully say that at this juncture I don't know what it all means, from the theoretical view point, nor from the practical perspective of what I am trying to accomplish, which is why the questions are flying in so thick and fast.
Last of all - teachers please, I don't want to go to Smalltalk kindergarten. I have done too much programming in my life to be put in kindergarten when I start Smalltalk. The problem here is although one can learn from reading examples, it can be hard to understand the language constructs unless they are derived from one's own use cases, and this is why my questions have been coming in so thick and fast.
Even in light of that wanting to use your own use cases, there is one example I would recommend [2] - since it is the best demonstration I've seen of the paradigm shift of programming in Squeak/Pharo's live environment. It is not entirely trivial - it took me a couple of days to get through it - but the main reason I recommend it is that it is more than a code example. It is a demonstration the power of the system to refactor as the design evolves from concept to deployment. The author exposes errors in design and how best to use the debugger. Kind of a "this is how things are done in Smalltalk". YMMV but I personally found it useful to help me change my approach from previous programming languages. It is actually one of the main things that mad me focus more on Smalltalk. You would need to temporarily regress a few years to use Squeak 3.9 to match the article, then come back to use the latest and greatest in current Pharo.
[2] http://squeak.preeminent.org/tut2007/html/index.html
cheers -ben
Guys
We love all your ideas and feedback. Now do you have an idea of the ratio Intelligent vs Pharo Eclispe vs Pharo in terms of payed engineering time?
Yes, but we work in the best environment in the world with enthusiasm, love and passion, that is our secret weapon ;-)
Indeed ;) Still this is important that people do not expect too much from us. Stef
forgot to mention, I also regularly refer to the "Terse Guide to Squeak" http://wiki.squeak.org/squeak/5699 Ben Coman wrote:
Frank Church wrote:
Hi Igor,
I am new to Smalltalk but not new to programming and I am into my first 14 hrs into learning it with Pharo.
Good to have you on board Frank. It will be interesting to follow your experience in becoming proficient in Smalltalk & Pharo. I am just coming up on a year of using Smalltalk/Pharo. There are a lot of hidden depths and I learn a lot watching the mail list for answers to questions that I hadn't thought of asking yet. So fire away. I'll just mention a few things that I have learned that make it easier to plumb the system for examples. Also see http://marianopeck.wordpress.com/2012/05/19/pharo-tips-and-tricks/
As I was trying to work out the right syntax it brought to mind the thoughts of Brendan Eich, Gilad Bracha and Lars Bak who said the familar syntax (Algol/C style) of languages like Javascript, Go and Dart was chosen to make it easier for programmers familiar with C, Pascal etcetera to starting using. them, rather than learn a whole new paradigm, even at the cost of complicated parsing and language structure.
The flipside is that it makes it easier to continue operating with your old paradigms in a hybrid manner, preventing you gaining the most 'stretch' most from a new paradigm. That is a very personal choice depending on what you want to gain from new learnings. However the main paradigm shift of Smalltalk is not its syntax but its 'live environment'.
If I was using Eclipse IDE for instance, at every step I could use auto-completion and the documentation to decide what follows from what, even in a domain I had no familiarity with, but Smalltalk doesn't lend itself to that approach.
I was going to just ask for some examples of what you particularly liked in Eclipse. We can learn from other systems. However with a quick browse I found [1]. Do you have anything to add to that? [1] http://eclipse.org/recommenders/documentation/usr.html
A few thoughts in response...
_Intelligent Code Templates_ - "But code templates /really/ shine when developers have to use APIs they are not very familiar with. Then, code templates serve as additional documentation that quickly shows how an API can be used and save developers lot of time otherwise needed for reading API documentation. Eclipse maintains more than 70 of such Java code templates"
Within Smalltalk, rather than 70 templates you have the whole system. If you are browsing a class and see a method which seems like what you want, click <Senders> to get an idea of how to use them. Another way to learn the system is to temporarily edit any method to insert a 'self haltOnce' then 'World-menu > System > Enable halt/inspect once' which will bring up a debugger where you can explore the call chain to see a live demonstration of how that method is used. The reason to use #haltOnce rather than #halt is that method might be used by the display system and you wold end up locking the image with cascading halts as the display loop runs. Using halos, you can <Duplicate> that menu item and leave it sitting on the background as a button for easy access.
You can highlight any method and use <cmd-n> or <cmd-m> to get a list of senders & implementors of that method. I often find myself following several levels to understand a chain of calls.
Learn the difference in using the <Into> <Over>& <Through> buttons when debugging (eg from the Workspace context menu) something like '#(1 2 3 4) do: [ :x | Transcript crShow: x].' For quite a while I had missed using <Through> properly which hamstrung me when tracing code and not wanting to trace the machinery of how #do: worked.
_Intelligent Overrides Completion_ & _Subclassing Directives_ & _Self-call Directives_ These look interesting, in particular if they bought up examples from public repositories outside the image.
With spoken languages even without proper syntax or phrasing a person who knows the language can deduce what you are trying to say but with computers you either get it right or the computer stares back at you blankly.
As an experienced programmer I am trying to accomplish something non-trivial as hard and as fast as I can with Squeak, Pharo and their supporting libraries and ecosystem and the only way is to bombard the mailing lists and forums. You could say I am trying to understand how the language constructs can support my intentions as fast as I can.
With respect to the above I can truthfully say that at this juncture I don't know what it all means, from the theoretical view point, nor from the practical perspective of what I am trying to accomplish, which is why the questions are flying in so thick and fast.
Last of all - teachers please, I don't want to go to Smalltalk kindergarten. I have done too much programming in my life to be put in kindergarten when I start Smalltalk. The problem here is although one can learn from reading examples, it can be hard to understand the language constructs unless they are derived from one's own use cases, and this is why my questions have been coming in so thick and fast.
Even in light of that wanting to use your own use cases, there is one example I would recommend [2] - since it is the best demonstration I've seen of the paradigm shift of programming in Squeak/Pharo's live environment. It is not entirely trivial - it took me a couple of days to get through it - but the main reason I recommend it is that it is more than a code example. It is a demonstration the power of the system to refactor as the design evolves from concept to deployment. The author exposes errors in design and how best to use the debugger. Kind of a "this is how things are done in Smalltalk". YMMV but I personally found it useful to help me change my approach from previous programming languages. It is actually one of the main things that mad me focus more on Smalltalk. You would need to temporarily regress a few years to use Squeak 3.9 to match the article, then come back to use the latest and greatest in current Pharo.
[2] http://squeak.preeminent.org/tut2007/html/index.html
cheers -ben
Hi Frank, Just reading old mail to catch up with community memory I found this mail. I don't know if you know about playgrounds on Moose[1], which by default stores all playgrounds (kind of rethought workspaces) in a cache. Also I'm working recently on Grafoscopio[2] which is a project that can store workspaces content and mix them with documentation (still on alpha status). [1] http://moosetechnology.org/ [2] http://mutabit.com/offray/static/blog/output/posts/grafoscopio-idea-and-init... May be taking a look of them could help you to explore solutions that fit you more. Cheers, Offray El 07/01/13 a las 07:43, Frank Church escribió:
Hi guys,
My images are gathering a number of Workspaces whose contents I don't want to delete.
I want to create a collection of Workspace contents along this defintion:
Description Date Category Content (the actual text in the Workspace).
In the final version I would like to be able to select a workspace and simply click a button or a menu item and get a dialog where I can enter the Description, Category and Date with the Workspace contents automatically captured into a text box. Copying and pasting the contents would be okay to start with.
Filing it out would be another aspect later.
What kind of array would best suited to the task? There is quite a number of them depicted here: http://www.jmcsweeney.co.uk/computing/m206/collections_intro.php
What could be the best way to go about it?
For those who are curious I am experimenting with the original ideas of Smalltalk where a computer user would do everything in Smalltalk workspace/desktop. I am intrigued by the possibility and somehow it seems eminently doable.
-- Frank Church
======================= http://devblog.brahmancreations.com
participants (10)
-
Ben Coman -
Frank Church -
Igor Stasenko -
Jesus Nuñez -
Marcus Denker -
Offray Vladimir Luna Cárdenas -
Paul DeBruicker -
Sean P. DeNigris -
Stéphane Ducasse -
Sven Van Caekenberghe