How do I save contents of Workspace into a collection?

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

Re: How do I save contents of Workspace into a collection?

Frank Church
On 10 January 2013 19:31, Igor Stasenko <[hidden email]> wrote:

> On 10 January 2013 18:29, Paul DeBruicker <[hidden email]> 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

Reply | Threaded
Open this post in threaded view
|

Re: How do I save contents of Workspace into a collection?

Frank Church
> 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

Reply | Threaded
Open this post in threaded view
|

Re: How do I save contents of Workspace into a collection?

Stéphane Ducasse
In reply to this post by Frank Church
>
>
> 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
>


Reply | Threaded
Open this post in threaded view
|

Re: How do I save contents of Workspace into a collection?

Ben Coman
In reply to this post by Frank Church
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

Reply | Threaded
Open this post in threaded view
|

Re: How do I save contents of Workspace into a collection?

Marcus Denker-4

On Jan 12, 2013, at 1:19 AM, Ben Coman <[hidden email]> 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


Reply | Threaded
Open this post in threaded view
|

Re: How do I save contents of Workspace into a collection?

Jesus Nuñez
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 <[hidden email]>

On Jan 12, 2013, at 1:19 AM, Ben Coman <[hidden email]> 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



Reply | Threaded
Open this post in threaded view
|

Re: How do I save contents of Workspace into a collection?

Jesus Nuñez
In reply to this post by Marcus Denker-4
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 <[hidden email]>

On Jan 12, 2013, at 1:19 AM, Ben Coman <[hidden email]> 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



Reply | Threaded
Open this post in threaded view
|

Re: How do I save contents of Workspace into a collection?

Jesus Nuñez
Sorry for the misleading term of "heap allocation procedures", better call it a piece of code :)


2013/1/12 Jesus Nuñez <[hidden email]>
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 <[hidden email]>

On Jan 12, 2013, at 1:19 AM, Ben Coman <[hidden email]> 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




Reply | Threaded
Open this post in threaded view
|

Re: How do I save contents of Workspace into a collection?

Jesus Nuñez
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 <[hidden email]>
Sorry for the misleading term of "heap allocation procedures", better call it a piece of code :)


2013/1/12 Jesus Nuñez <[hidden email]>
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 <[hidden email]>

On Jan 12, 2013, at 1:19 AM, Ben Coman <[hidden email]> 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





Reply | Threaded
Open this post in threaded view
|

Re: How do I save contents of Workspace into a collection?

Igor Stasenko
In reply to this post by Jesus Nuñez
On 12 January 2013 03:03, Jesus Nuñez <[hidden email]> 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.

Reply | Threaded
Open this post in threaded view
|

Re: How do I save contents of Workspace into a collection?

Igor Stasenko
In reply to this post by Jesus Nuñez
On 12 January 2013 03:43, Jesus Nuñez <[hidden email]> 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 <[hidden email]>
>>
>> Sorry for the misleading term of "heap allocation procedures", better call
>> it a piece of code :)
>>
>>
>> 2013/1/12 Jesus Nuñez <[hidden email]>
>>>
>>> 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 <[hidden email]>
>>>>
>>>>
>>>> On Jan 12, 2013, at 1:19 AM, Ben Coman <[hidden email]> 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.

Reply | Threaded
Open this post in threaded view
|

Re: How do I save contents of Workspace into a collection?

Stéphane Ducasse
In reply to this post by Jesus Nuñez
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 <[hidden email]>
>
> On Jan 12, 2013, at 1:19 AM, Ben Coman <[hidden email]> 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
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: How do I save contents of Workspace into a collection?

Stéphane Ducasse
In reply to this post by Ben Coman
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
>


Reply | Threaded
Open this post in threaded view
|

Re: How do I save contents of Workspace into a collection?

Ben Coman
In reply to this post by Ben Coman
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
>
>


Reply | Threaded
Open this post in threaded view
|

Re: How do I save contents of Workspace into a collection?

Sven Van Caekenberghe-2
In reply to this post by Stéphane Ducasse

On 12 Jan 2013, at 09:28, Stéphane Ducasse <[hidden email]> 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
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: How do I save contents of Workspace into a collection?

Stéphane Ducasse

>> 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



Reply | Threaded
Open this post in threaded view
|

Re: How do I save contents of Workspace into a collection?

Offray
In reply to this post by Frank Church
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-initial-progress.html 


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
>


12