Skip to Content.
Sympa Menu

maude-help - Re: [Maude-help] MEL and reflection

maude-help AT lists.cs.illinois.edu

Subject: Maude-help mailing list

List archive

Re: [Maude-help] MEL and reflection


Chronological Thread 
  • From: Francisco Durán <duran AT lcc.uma.es>
  • To: Patrick Browne <patrick.browne AT dit.ie>
  • Cc: "maude-help AT cs.uiuc.edu" <maude-help AT cs.uiuc.edu>
  • Subject: Re: [Maude-help] MEL and reflection
  • Date: Mon, 11 Apr 2011 13:19:11 +0200
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/maude-help>
  • List-id: <maude-help.cs.uiuc.edu>

Hi Pat,

The META-LEVEL module provides key sorts (like Term and Module) and key
functionality (operations like metaReduce or metaRewrite) which facilitate
access to the metalevel of Maude. Asking whether we can access Maude's
metalevel without the META-LEVEL module is like asking whether we can have
access to Java's metalevel without the Class class. Well, it must be there,
loaded in the system, although you don't really need to name it.

The getClass method to get the Class object is like using upModule to get the
metarepresentation of the module. To get "things" from this module, or from
terms in that module, you can use functions in the META-LEVEL module or
define your own ones.

Can I get the sort of a data item? Let me use my FOO module again:

reduce leastSort(upModule('FOO, false), upTerm(f(true))) .

Of course, for this command to be evaluated it has to be in the context of a
module importing both META-LEVEL and the FOO module, my BAR module.

The result is

result Sort: 'Bar

Cheers,

Francisco

El 11/04/2011, a las 11:09, Patrick Browne escribió:

> Francisco,
> In OO languages, such as Java, the term reflection means that a program
> can access information about objects (e.g. find its class at runtime). I
> wish to know whether MEL can perform a similar task in Maude (i.e. find
> the sort of a data item). Can MEL alone without explicit reference to
> META-LEVEL provide this type of reflection?
>
> My motivation is that I need to know precisely how this OO style
> reflection is done in Maude.
>
> Pat
>
> On 10/04/2011 22:30, Francisco Durán wrote:
>> Hi Pat,
>>
>> I'm not sure whether there is something more behind your question, I don't
>> get that of "the kind and object level", but I would say that the answer
>> is yes, almost everything in Maude is reflected, and can be used at
>> Maude's metalevel.
>>
>> fmod FOO is
>> sorts Foo Bar .
>> subsort Bar < Foo .
>> op f : Bool -> Foo .
>> var B : Bool .
>> cmb f(B) : Bar if B .
>> endfm
>>
>> fmod BAR is inc FOO + META-LEVEL . endfm
>>
>> red metaReduce(upModule('FOO, false), upTerm(f(true))) .
>>
>> Francisco
>
>
> This message has been scanned for content and viruses by the DIT
> Information Services E-Mail Scanning Service, and is believed to be clean.
> http://www.dit.ie






Archive powered by MHonArc 2.6.16.

Top of Page