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: Michael Katelman <katelman AT uiuc.edu>
  • To: Francisco Durán <duran AT lcc.uma.es>
  • 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 09:20:06 -0500
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/maude-help>
  • List-id: <maude-help.cs.uiuc.edu>

At least regarding sorts, which you mentioned, that is part of the
object theory and doesn't require going to the meta-level:

cmb t1 : A if t2 : B .

does not require the meta-level to ask the question about t2 being of
sort B. So, something like type introspection exists without
implicit/explicit loading of META-LEVEL.

-Mike


On Mon, Apr 11, 2011 at 6:19 AM, Francisco Durán
<duran AT lcc.uma.es>
wrote:
> 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
>
>
> _______________________________________________
> Maude-help mailing list
> Maude-help AT cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/maude-help
>





Archive powered by MHonArc 2.6.16.

Top of Page