Hi Meikel,
Meikel Brandmeyer wrote:
> On Mon, May 31, 2010 at 07:34:24AM +0200, Sina K. Heshmati wrote:
>
>> > (defn make-module
>> > []
>> > (let [state (atom 0)
>> > say-hello (fn [] (println "Hello"))
>> > public-op (fn [x y] (+ @state x y))]
>> > (fn [op]
>> > (
Hi,
On Mon, May 31, 2010 at 07:34:24AM +0200, Sina K. Heshmati wrote:
> > (defn make-module
> > []
> > (let [state (atom 0)
> > say-hello (fn [] (println "Hello"))
> > public-op (fn [x y] (+ @state x y))]
> > (fn [op]
> > (case op
> > :hello say-hello
> >
Meikel Brandmeyer wrote:
> On May 31, 3:15 pm, "Sina K. Heshmati" wrote:
>
>> True but my main concern is security of a running application.
>> It could very well be that B is just a bunch of interactions,
>> in which case B can enter A's namespace.
>
> ??? I'm not sure I understand. How can B "
Hi,
On May 31, 3:15 pm, "Sina K. Heshmati" wrote:
> True but my main concern is security of a running application.
> It could very well be that B is just a bunch of interactions,
> in which case B can enter A's namespace.
??? I'm not sure I understand. How can B "enter" the namespace
of A? If y
Problem solved, see below.
Meikel Brandmeyer wrote:
> On May 31, 1:46 pm, "Sina K. Heshmati" wrote:
>
>> Here's my concern:
>>
>> - My program (A) is running.
>> - B is running on the same VM.
>> - B accesses the state of A.
>> - B alters the state of A in an inconsistent way
>> e.g. whenever
Hi,
On May 31, 1:46 pm, "Sina K. Heshmati" wrote:
> Here's my concern:
>
> - My program (A) is running.
> - B is running on the same VM.
> - B accesses the state of A.
> - B alters the state of A in an inconsistent way
> e.g. whenever the internal state x changes, the
> internal state y also
"Meikel Brandmeyer" said:
> On May 31, 10:58 am, "Sina K. Heshmati" wrote:
>
>> foo.datatype-01 => (reset! state 13)
> ^^^
>
> Again: of course you can! You are in the same namespace! In Clojure
> the "unit" is a namespace and not a type. If you want this level
> privateness you h
Hi,
On May 31, 10:58 am, "Sina K. Heshmati" wrote:
> foo.datatype-01 => (reset! state 13)
^^^
Again: of course you can! You are in the same namespace! In Clojure
the "unit" is a namespace and not a type. If you want this level
privateness you have to use one namespace per type. Ho
"Meikel Brandmeyer" said:
> On May 31, 9:37 am, "Sina K. Heshmati" wrote:
>
>> The atomic 'state' doesn't seem to be visible to the datatype methods. The
>> question is why?
>>
>> (defprotocol prot-a
>> (op-a [self x y]))
>>
>> (let [state (atom 10)]
>> (deftype t-a [member]
>> prot-a
>>
Hi,
On May 31, 9:37 am, "Sina K. Heshmati" wrote:
> The atomic 'state' doesn't seem to be visible to the datatype methods. The
> question is why?
>
> (defprotocol prot-a
> (op-a [self x y]))
>
> (let [state (atom 10)]
> (deftype t-a [member]
> prot-a
> (op-a [self x y]
> (+ (.
Sina K. Heshmati wrote:
> Meikel Brandmeyer wrote:
>> Am 30.05.2010 um 16:39 schrieb Sina K. Heshmati:
>>
> I'll later try to see if I can export datatypes from within a closure.
The atomic 'state' doesn't seem to be visible to the datatype methods. The
question is why?
(defprotocol prot-a
(op
Hi Meikel,
Meikel Brandmeyer wrote:
> Am 30.05.2010 um 16:39 schrieb Sina K. Heshmati:
>
>> [2]
>> http://github.com/sindoc/algorithms/blob/master/src/test/clojure/whiteboard/y2010/hide-adt-state-using-closure.clj
>
> I'm almost sure, that this code does not what you expect. Nested def's, and
Hi,
Am 30.05.2010 um 16:39 schrieb Sina K. Heshmati:
> [2]
> http://github.com/sindoc/algorithms/blob/master/src/test/clojure/whiteboard/y2010/hide-adt-state-using-closure.clj
I'm almost sure, that this code does not what you expect. Nested def's, and in
particular defn's, are almost surely w
"Adrian Cuthbertson" said:
>> That said, I'd rather make sure that my low-level data structures are being
>> operated on by only one implementation.
>
> You could use closures to encapsulate the refs/atoms ...
>
> (let [car-mem (ref nil)]
> (defn set-car-mem [new-car-mem]
> (dosync (ref-
> That said, I'd rather make sure that my low-level data structures are being
> operated on by only one implementation.
You could use closures to encapsulate the refs/atoms ...
(let [car-mem (ref nil)]
(defn set-car-mem [new-car-mem]
(dosync (ref-set car-mem new-car-mem)))
(defn update-
Krukow wrote:
> Sina K. Heshmati wrote:
> [snip]
>> The only member data _I'm_ able find are the ones that are passed to the
>> default
>> constructor, namely at the time that the abstraction is reified. What if I'd
>> have
>> to give create a member field that is not necessarily known by the cal
On May 28, 9:59 pm, "Sina K. Heshmati" wrote:
> Hi Krukow,
[snip]
> The only member data _I'm_ able find are the ones that are passed to the
> default constructor, namely at the time that the abstraction is reified. What
> if I'd have to give create a member field that is not necessarily known
Hi Krukow,
Krukow wrote:
> SinDoc wrote:
>> I was wondering if someone could point me to recent usage examples of
>> deftype, defrecord, and reify. Reading [1] helped a lot but it wasn't
>> particularly easy to find it since it's not linked from the sidebar.
>
> Blog: http://blog.higher-order.net
Hi Meikel,
Meikel Brandmeyer wrote:
> SinDoc wrote:
>> I was wondering if someone could point me to recent usage examples of
>> deftype, defrecord, and reify. Reading [1] helped a lot but it wasn't
>> particularly easy to find it since it's not linked from the sidebar.
>>
>> Specifically, what I'd
On May 28, 9:52 am, SinDoc wrote:
> L.S.,
>
> I was wondering if someone could point me to recent usage examples of
> deftype, defrecord, and reify. Reading [1] helped a lot but it wasn't
> particularly easy to find it since it's not linked from the sidebar.
I've used protocols and defrecords t
Hi,
On May 28, 9:52 am, SinDoc wrote:
> I was wondering if someone could point me to recent usage examples of
> deftype, defrecord, and reify. Reading [1] helped a lot but it wasn't
> particularly easy to find it since it's not linked from the sidebar.
>
> Specifically, what I'd like to know is:
L.S.,
I was wondering if someone could point me to recent usage examples of
deftype, defrecord, and reify. Reading [1] helped a lot but it wasn't
particularly easy to find it since it's not linked from the sidebar.
Specifically, what I'd like to know is:
- How to define and access member data f
22 matches
Mail list logo