[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

[CLOS] Influence behavior of slot accessors

Sebastian Christ

1/22/2016 8:52:00 AM

Hi folks,

I'm currently writing an ORM and I need some help. Consider this:

(defclass candidate (dao-object)
((votings :counterp t))
(:metaclass dao-class))

I've introduced a :COUNTERP slot-option through my DAO-CLASS. Further I
provide

(defmethod incr ((object dao-object) counter value)
...)

(defmethod decr ((object dao-object) counter value)
...)

to change the counter. Both methods check if COUNTERP is T for the given
COUNTER and both immediately touch the data store. My problem is, what if
someone writes this:

...
((votings :counterp t
:accessor votings))
...

A writer for this slot has undefined consequences. VOTINGS should only
be modifiable through INCR/DECR from above. So how can I prevent the
creation of a writer?

The reader should take the value of the counter from the data store
instead of accessing the slot via SLOT-VALUE. How can I change the
reader for a specific slot? For other slots the reader mechanism should
be untouched.

Maybe I can use a macro that expands to the right call to ENSURE-CLASS
or maybe there is even a simpler way (or the right way for that matter)
or maybe I'm doing it utterly wrong.

Thanks in advance anyway.

Regards,
Sebastian


--
Sebastian (Rudolfo) Christ
http://rudolfochrist...
GPG Fingerprint: 306D 8FD3 DFB6 4E44 5061
CE71 6407 D6F8 2AC5 55DD
18 Answers

Klaus Schadenfreude

1/3/2013 12:44:00 PM

0

>"Sanders Kaufman" <bucky@kaufman.net> wrote in talk.politics.guns :

>What's that worth?

Um, about 100 times anything YOU'VE ever said?

Orval Fairbairn

1/3/2013 6:50:00 PM

0

In article <YldFs.28072$411.12405@newsfe02.iad>,
"Sanders Kaufman" <bucky@kaufman.net> wrote:

> "Jane Galt" wrote in message
> news:XnsA13CE4FB1C0E1JaneWhoIsJaneGaltnet@216.196.121.131...
>
> > U.S. Marine???s Scathing Response to Sen. Feinstein???s Gun Control Proposal:
> > ???I
> > Am Not Your Subject. I Am the Man Who Keeps You Free???
>
> She never referred to him that way.
> She never treated him that way.
> Nobody under her command referred to him that way.
> There's just some clearly psychotic, anonymous, nobodies on the web saying
> it's so.
> What's that worth?

She may not have put it in words, but that is the attitude of the
Oppressives (Sorry -- "Progressives")

They seem to think that the Government owns its citizens and that they
are there to serve Government, rather than the other way around.

Sanders Kaufman [MCSD]

1/3/2013 6:58:00 PM

0

"Jan Panteltje" wrote in message news:kc3qbj$6dr$1@news.datemas.de...

> Study the last days of the Roman Empire.
> Idiots like you and that person were ruining the empire,

And then the Tea Party Survivalist Confederacy came along and SAVED US!!!
It's sad how you keep casting me as someone who is wildly successful,
larcenous and a member of a world ruling class.

Oh how low, On the totem pole,
You must be, Seeing that as me.


JohnJohnsn

1/3/2013 8:07:00 PM

0

On Thursday, January 3, 2013 12:57:55 PM UTC-6, Wanted TX Criminal Fugitive Sanders NMI Kaufman, W/M, DOB 08/03/1965, a/k/a "Bucky the Looney Liberal" Kaufman <Bucky@kaufman.net> <http://tinyurl.com/Sanders-NMI-K... stamped out:
>
>
> "Jan Panteltje" wrote in message news:kc3qbj$6dr$1@news.datemas.de...
>
>> Study the last days of the Roman Empire.
>
>> Idiots like you and that person were ruining the empire, ...
>
> And then the Tea Party Survivalist Confederacy came along and SAVED US!!!
> It's sad how you keep casting me as someone who is wildly successful,
> larcenous and a member of a world ruling class.
> Oh how low, On the totem pole, You must be, Seeing that as me.
>
Shows just how stupid a person the Dallas Independent School District will hire as a substitute teacher.

The "low man on the totem pole" can actually be the one held in highest regards by the people who carved and erected the totem pole, Bucky:

Vertical order of images is widely believed to be a significant representation of importance. This idea is so pervasive that it has entered into common parlance with the phrase "low man on the totem pole." This phrase is indicative of the most common belief of ordering importance, that the higher figures on the pole are more important or prestigious. A counterargument frequently heard is that figures are arranged in a "reverse hierarchy" style, with the most important representations being on the bottom, and the least important being on top. Actually, [among Native American totem poles], there have never been any restrictions on vertical order -- many poles have significant figures on the top, others on the bottom, and some in the middle. Other poles have no vertical arrangement at all, consisting of a lone figure atop an undecorated column.

http://en.wikipedia.org/wiki/...

Bucky; you are so insignificant in the overall scheme of things that you have _no_place_ on _any_ totem pole.

Here's your "claim to fame," Bucky:

http://www.facebook....

"The US can never win against terrorism until we eliminate the NeoChristian insurgents."
--Sanders NMI Kaufman, Jr.

BTW, Bucky: has the Garland Police Department caught up to you to serve those Warrants of Arrest they hold for your Looney Liberal ass?

<+>

"Laws that forbid the carrying of arms... disarm only those who are neither inclined nor determined to commit crimes... Such laws make things worse for the assaulted and better for the assailants; they serve rather to encourage than to prevent homicides, for an unarmed man may be attacked with greater confidence than an armed man. "
--Thomas Jefferson

"False is the idea of utility that sacrifices a thousands real advantages for one imaginary or trifling inconvenience’ that would take fire from men because it burns, and water because one may drown in it; that has no remedy for evils, except destruction. The laws that forbid the carrying of arms are laws of such a nature. They disarm those only who are neither inclined nor determined to commit crimes."
--Cesare Bonesana, Marchese Beccaria, `Of Crimes and Punishments'

"Why is it that every time a lunatic uses a firearm to commit an atrocity the gun-control fanatics want to punish the millions of gun owners that DIDN'T do it?!?!?
--Me, Dec. 18, 2012

Sanders Kaufman [MCSD]

1/4/2013 12:17:00 AM

0

"Orval Fairbairn" wrote in message
news:orfairbairn-0D7D04.13501203012013@70-3-168-216.pools.spcsdns.net...

> They seem to think that the Government owns its citizens and that they
> are there to serve Government, rather than the other way around.

It's funny when impotent little nobodies like you talk about what the
government "thinks".
Notably, it always seems to "think" something bad about you..

Is it really the government that makes you feel "owned"?
Or could your sense of inferiority be better associated with some aspect of
your own character?


Orval Fairbairn

1/4/2013 1:14:00 AM

0

In article <5cpFs.26760$TH3.19084@newsfe12.iad>,
"Sanders Kaufman" <bucky@kaufman.net> wrote:

> "Orval Fairbairn" wrote in message
> news:orfairbairn-0D7D04.13501203012013@70-3-168-216.pools.spcsdns.net...
>
> > They seem to think that the Government owns its citizens and that they
> > are there to serve Government, rather than the other way around.
>
> It's funny when impotent little nobodies like you talk about what the
> government "thinks".
> Notably, it always seems to "think" something bad about you..
>
> Is it really the government that makes you feel "owned"?
> Or could your sense of inferiority be better associated with some aspect of
> your own character?

No - it is "Progressives," like yourself who think that the government
owns its citizens and all the fruits of their labor.

The Planetary Bill of Rights Project

1/4/2013 1:49:00 AM

0

Orval Fairbairn <orfairbairn@earthlink.net> wrote :

> In article <5cpFs.26760$TH3.19084@newsfe12.iad>,
> "Sanders Kaufman" <bucky@kaufman.net> wrote:
>
>> "Orval Fairbairn" wrote in message
>> news:orfairbairn-0D7D04.13501203012013@70-3-168-216.pools.spcsdns.net...
>>
>> > They seem to think that the Government owns its citizens and that
>> > they are there to serve Government, rather than the other way around.
>>
>> It's funny when impotent little nobodies like you talk about what the
>> government "thinks".
>> Notably, it always seems to "think" something bad about you..
>>
>> Is it really the government that makes you feel "owned"?
>> Or could your sense of inferiority be better associated with some
>> aspect of your own character?
>
> No - it is "Progressives," like yourself who think that the government
> owns its citizens and all the fruits of their labor.
>

There's a stark difference between forced-collectivism and individual rights,
but you need to stop arguing between left and right flavors of forced-
collectivism and recognize it.

--
If you've always lived under a dictatorship or authoritarian regime,
your country once knew freedom and is losing it, or has lost it
and you would like to read about individual liberty, this Project
is here for you. Will you have a better life under forced-collectivism,
or with freedom, self-ownership and personal responsibility?
Peace, freedom and prosperity are within easy reach.

The Planetary Bill of Rights Project
A Blueprint for Peace, Prosperity and Freedom
A Global Freedom Movement In A Book
http://tinyurl.c...

The Planetary Bill of Rights Project

1/4/2013 4:07:00 AM

0

Orval Fairbairn <orfairbairn@earthlink.net> wrote :

> In article <5cpFs.26760$TH3.19084@newsfe12.iad>,
> "Sanders Kaufman" <bucky@kaufman.net> wrote:
>
>> "Orval Fairbairn" wrote in message
>> news:orfairbairn-0D7D04.13501203012013@70-3-168-216.pools.spcsdns.net...
>>
>> > They seem to think that the Government owns its citizens and that
>> > they are there to serve Government, rather than the other way around.
>>
>> It's funny when impotent little nobodies like you talk about what the
>> government "thinks".
>> Notably, it always seems to "think" something bad about you..
>>
>> Is it really the government that makes you feel "owned"?
>> Or could your sense of inferiority be better associated with some
>> aspect of your own character?
>
> No - it is "Progressives," like yourself who think that the government
> owns its citizens and all the fruits of their labor.
>



--
"Handbook of freedom"

If you've always lived under a dictatorship or authoritarian regime,
your country once knew freedom and is losing it, or has lost it
and you would like to read about individual liberty, this Project
is here for you. Will you have a better life under forced-collectivism,
or with freedom, self-ownership and personal responsibility?
Peace, freedom and prosperity are within easy reach.

The Planetary Bill of Rights Project
A Blueprint for Peace, Prosperity and Freedom
A Global Freedom Movement In A Book
http://tinyurl.c...

smh

1/22/2016 2:06:00 PM

0

In general Common Lisp does not provide mechanisms to prevent user code from accessing or messing with intermals of lower level modules. An exception is the very-weak protection of the double-colon im reader syntax, compared to the public/private distintion in languages like Java.

Suppose your "What if?" question were:

What if some user executes (rotatef (fdefinition 'car) (fdefinition 'cdr))?

An implementation _might_ protect function bindings of symbols in the :common-lisp package, but the language definition does not requirethis. Your Lisp execution might be totally broken.

Now, if your favorite implementation actually conforms to the MOP, the MOP could provide effective control over slot access. You are already using a custom metaclass. The presence of the :counterp slot option could cause the slot to be represented by a custom effective-slot-definition class, and a setf slot-value-using-class (which setf slot-value is _required_ to call unless it can prove that access has not been customized beyond the standard metaclasses) can impose whatever restrictions you desire.

You'll learn a lot figuring out how to make all this work. :-)

Be aware that using specialized metaclasses and slot-definition classes may cause greatly decreased performance in slot access, This is because implementations can and do optimize slot access ("inline" in the ANS description of slot-value) and completely bypass the weighty ,achinery of slot-value-using-class only when they can prove behavior has not been customized beyond that of standard-class and standard-effective-slot-definition

Kaz Kylheku

1/22/2016 5:36:00 PM

0

On 2016-01-22, smh <shaflich@gmail.com> wrote:
> In general Common Lisp does not provide mechanisms to prevent user
> code from accessing or messing with intermals of lower level modules.
> An exception is the very-weak protection of the double-colon im reader
> syntax, compared to the public/private distintion in languages like
> Java.
>
> Suppose your "What if?" question were:
>
> What if some user executes (rotatef (fdefinition 'car) (fdefinition
> 'cdr))?

What if someone grabs both your balls and twists?