Re: Just can't hear enough about Cells?
- From: Ken Tilton <kentilton@xxxxxxxxx>
- Date: Wed, 31 May 2006 13:00:45 -0400
Takehiko Abe wrote:
Here is a minimal primer on Cells, just enough for you to
keep up with the next tutorial. That will be a substantial project
in which we develop a CLOS object inspector.
The Inspector project will give you a feel for what it is like to program with Cells and Cello /after/ you are fluent in the
technology. The intent is not to teach you Cello, rather to
motivate your learning it.
Is the motivation available?
You mean the actual source for the Cell-based Inspector, Cloucells? Somewhere. If you like I could send it along (or it might be in the Cello repository on c-l.net). Caveat: won't run. Goes back to Cells 1.0. And it ran under Cello, which I am resurrecting this week. Not sure why I thought it would make a good tutorial. Might be better to replicate the ACL "apropos" dialog, which I will miss when I move to Lispworks.
But boy did Cloucells turn out be (a) amazing and (b) hairy. (b) because a Cell itself could be the value mediated by a Cell! (a) because, thanks to (b), well, I could start Cloucells, inspect the Cloucells window, navigate to the slot holding the current mouse position, and watch the mouse position change as, well, the mouse position changed. Without coding to make it happen. Sick.
[...]
The Cell programmer writes:
(make-instance 'menu-item
:name :cut
:label "Cut"
:cmd-key +control-x+
:actor #'do-cut
:enabled (c? (when (typep (focus *app*) 'text-edit-widget)
(not (null (selected-range (focus *app*)))))))
looks familiar.
Sure. Most GUI libraries consist of hundreds of hamsters running around behind the scenes providing GUI developers with some small amount of automatic dataflow. Cells solves that problem in general.
(make-instance 'menu-item
:menu-item-title "Cut"
:command-key '(:control #\x)
:menu-item-action #'do-cut
:update-function
#'(lambda (item)
(let ((w (front-window)))
(if (and w
(multiple-value-bind (b e)
(selection-range w)
(neq b e)))
(menu-item-enable item)
(menu-item-disable item)))))
This schemeworks well because menu-items are hidden most of
the time.
...and now they can forget the menu item exists as they work
on the rest of the application. The menu-item enabled status
will stay current (correct) as the selected-range changes
and as the focus itself changes as the user moves from field
to field.
And we don't need to care --- questions like: Who starts the
update? And how often it is triggered? -- with cells?
No need to worry. If you have a heavy hitter causing (a) a lot of updating and (b) your understanding of the semantics tells you some of that can be skipped, you have options such as laziness or filters on a dependency to avoid unnecessary computation.
Anyways I downloaded cells_2.0 and tried it with MCL5.1.
It loaded fine with a very simple mod.
But I am not sure if it is working.
(test-cells) finished without an error. Does this mean
it is working?
Yes. It goes kersplat if there is a problem. I should print "Cells is working fine." at the end, eh? I will try to remember to do that later on, gotta run now.
kt
--
Cells: http://common-lisp.net/project/cells/
"Have you ever been in a relationship?"
Attorney for Mary Winkler, confessed killer of her
minister husband, when asked if the couple had
marital problems.
.
- Follow-Ups:
- Re: Just can't hear enough about Cells?
- From: Steven E. Harris
- Re: Just can't hear enough about Cells?
- References:
- Just can't hear enough about Cells?
- From: Ken Tilton
- Re: Just can't hear enough about Cells?
- From: Michael Livshin
- Re: Just can't hear enough about Cells?
- From: Ken Tilton
- Re: Just can't hear enough about Cells?
- From: Jacques Chester
- Re: Just can't hear enough about Cells?
- From: Ken Tilton
- Re: Just can't hear enough about Cells?
- From: Takehiko Abe
- Just can't hear enough about Cells?
- Prev by Date: How to determine the top caller in Slime's REPL
- Next by Date: Re: Just can't hear enough about Cells?
- Previous by thread: Re: Just can't hear enough about Cells?
- Next by thread: Re: Just can't hear enough about Cells?
- Index(es):
Relevant Pages
|