Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Metaprogramming in Eiffel?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Georg Bauhaus  
View profile  
 More options Feb 3 2011, 3:45 pm
Newsgroups: comp.lang.eiffel
From: Georg Bauhaus <rm-host.bauh...@maps.futureapps.de>
Date: Thu, 03 Feb 2011 21:45:29 +0100
Local: Thurs, Feb 3 2011 3:45 pm
Subject: Metaprogramming in Eiffel?
Hi,

for some time now, a Wikipedia page is rumoring that languages
other than C++ and D can be used to achieve the effects of
template *meta*programming.  That is, we can have our compilers
compute "functions," recursively, at compile time.  The term
"function" here refers to an abstract mathematical thing and
their outcome is (the appearance of) a somewhat different program,
produced implicitly, at compile time.

(A standard example is factorial, showing two essential
characteristics of template metaprogramming, not usually
present in generics:

(1)  have the compiler compute factorial(N), N being known at
compile time, by recursively instantiating a series of templates
(at compile time).  Each instantiation in turn triggers the
instantiation of more of the same templates (with N decremented)
until finally the compiler finishes its work when it finds
a template specialized for the case N = 0.

(2) No function code is produced, just a result.)

I don't think this recursive template resolution has much to
do with generics in Eiffel, or has it?

Note that this is *not* just about good optimizers: these will
compute factorial(N), too, without anything generic  in sight,
when N is known at compile time.
That's beside the point.  Eiffel Compilers will still do as
they should and produce code of a feature named "factorial"
should that feature have been defined in a class.  The C++
example leaves no function.

Also, can Eiffel generics be used for turning dynamic polymorphism
into static polymorphism?

I'll boldly correct the Wikipedia article should the above
negative result be correct.

- Georg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
llothar  
View profile  
 More options Mar 2 2011, 8:37 am
Newsgroups: comp.lang.eiffel
From: llothar <scholz.lot...@gmail.com>
Date: Wed, 2 Mar 2011 05:37:00 -0800 (PST)
Subject: Re: Metaprogramming in Eiffel?
On Feb 3, 9:45 pm, Georg Bauhaus <rm-host.bauh...@maps.futureapps.de>
wrote:

> for some time now, a Wikipedia page is rumoring that languages
> other than C++ and D can be used to achieve the effects of
> template *meta*programming.  

No. Eiffel Generics can't do any meta programming.

The main difference between Eiffel Generics and C++ is that the
first are embedded into the language type system. The main
this works well is also one of the main differences to other
language: covariant redefinition of function arguments.

> Also, can Eiffel generics be used for turning dynamic polymorphism
> into static polymorphism?

This can be done, but it's not a feature of the template system
but based on the fact that Eiffel as a full system optimizing language
has much more information then a C++ compiler. So even non template
code can turning dynamic polymorphism into static polymorphism

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Georg Bauhaus  
View profile  
 More options Mar 3 2011, 8:33 am
Newsgroups: comp.lang.eiffel
From: Georg Bauhaus <rm.dash-bauh...@futureapps.de>
Date: Thu, 03 Mar 2011 14:33:04 +0100
Local: Thurs, Mar 3 2011 8:33 am
Subject: Re: Metaprogramming in Eiffel?
On 02.03.11 14:37, llothar wrote:

> On Feb 3, 9:45 pm, Georg Bauhaus <rm-host.bauh...@maps.futureapps.de>
> wrote:

>> for some time now, a Wikipedia page is rumoring that languages
>> other than C++ and D can be used to achieve the effects of
>> template *meta*programming.  

> No. Eiffel Generics can't do any meta programming.

OK

>> Also, can Eiffel generics be used for turning dynamic polymorphism
>> into static polymorphism?

> This can be done, but it's not a feature of the template system
> but based on the fact that Eiffel as a full system optimizing language
> has much more information then a C++ compiler. So even non template
> code can turning dynamic polymorphism into static polymorphism

I doubt this has much to do with the reach of compilers---IBM's
C++ compiler has been an incremental compiler for years, but even
this may not be important.  But AFAIK, "virtual" in C++ forces
dispatching no matter what whereas both absence of "virtual"
and qualifying the method name will let programmers choose the
specific method at compile time.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »