Sunday, January 29, 2006

Slideshow In Squeak

Alright, I spent the weekend playing around with Squeak and came up with the following snippet:
| allProjects  doBlock |
allProjects := ((Project allProjectsOrdered copyWithout: Project current)
addLast: Project current; yourself)
doBlock :=
[:project | | enterBlock exitBlock |
enterBlock := [(Delay forMilliseconds: 1000) wait. allProjects next ifNotNilDo: [:next | doBlock copy value: next]].
exitBlock := [World removeActionsWithReceiver: enterBlock].
project world
when: #aboutToEnterWorld send: #value to: enterBlock;
when: #aboutToLeaveWorld send: #value to: exitBlock.
project enter].
doBlock copy value: allProjects next.

It basically makes a slideshow of your projects and shows them one second apart. The obvious solution didn't work:
((Project allProjectsOrdered copyWithout: Project current) 
addLast: Project current; yourself) do: [:each |
(Delay forMilliseconds: 1000) wait.
each enter]

The reason is that when a project is switched, all of its threads are terminated on exit. This makes sense if you think of each project as it's own "world". So, I quickly whipped out the code in the first snippet. It was basically an understanding for me to try out different things. There's so much to explore and learn.

I want to give my presentation in Squeak and show off our great environment. I'm having fun playing around. It's funny, I've been a Squeak developer for at least a few years now and still haven't fully explored Morphic. Mainly, I've worked on backend frameworks or Seaside. But, I dabble every year for a small amount of time. The presentation will give me a reason to more fully explore the untapped potential.

1 comment:

johneyprice5665921845 said...

I read over your blog, and i found it inquisitive, you may find My Blog interesting. So please Click Here To Read My Blog