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
bindings with Ada 2012 aspects
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
  8 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
 
Jerrid Kimball  
View profile  
 More options Apr 24 2012, 7:54 pm
Newsgroups: comp.lang.ada
From: Jerrid Kimball <jer...@kimball.co>
Date: Tue, 24 Apr 2012 18:54:50 -0500
Local: Tues, Apr 24 2012 7:54 pm
Subject: bindings with Ada 2012 aspects
Hello!  Long time reader, first time poster.

Before I get started, remember that there is a friendly channel on
Freenode IRC network dedicated to dicussing Ada and creating a general
sense of community around the language.  The channel population (around
60) would profit by any additional great conversation or insights that
can be brought about.  Thanks!

In my spare time I've been tinkering with Ada 2012 and just happened to
be working on making a C main play nicely with Ada tasking.  Anyway,
long story short, I came to wanting to export some Ada subprograms for
the C main to use, but I'm finding that either the appropriate aspects
are broken in GNAT Pro 7.1w or my understanding of the new syntax is flawed.

As I see it, a pragma Export should be directly replaceable by
interfacing aspects' aspect marks and definitions:

procedure Wait renames PO.Wait;
pragma Export (C, Wait, "wait");

becomes:

procedure Wait renames PO.Wait
    with Export => True, Convention => C, Link_Name => "wait";

Am I looking at what should be submitted to ACT as a bug?

Jerrid Kimball


 
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.
Martin  
View profile  
 More options Apr 25 2012, 3:43 am
Newsgroups: comp.lang.ada
From: Martin <mar...@thedowies.com>
Date: Wed, 25 Apr 2012 00:43:07 -0700 (PDT)
Local: Wed, Apr 25 2012 3:43 am
Subject: Re: bindings with Ada 2012 aspects

I've run into 1 'feature' with aspects in GNAT 7.1, which is you can't currently mix them with expression functions.

Ada2012 support is still 'in progress'...but still very useable as is for the most part.

I'm loving the new "for .. of" iterator support - much cleaner code!

Also, expression functions are useful in that I can now leave the package body for subprograms that manipulate state, i.e. actually *do* stuff! Keeps them smaller and should therefore help in understanding as you can see more on one screen at a time.

I've adopted a certain style with expression functions though which is to place them right at the end of the private section of the package spec - after everything else. This keeps the public view free from implementation detail as possible.

-- Martin


 
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.
Stephen Leake  
View profile  
 More options Apr 25 2012, 8:09 am
Newsgroups: comp.lang.ada
From: Stephen Leake <stephen_le...@stephe-leake.org>
Date: Wed, 25 Apr 2012 08:09:26 -0400
Local: Wed, Apr 25 2012 8:09 am
Subject: Re: bindings with Ada 2012 aspects

Jerrid Kimball <jer...@kimball.co> writes:
> Hello!  Long time reader, first time poster.

Welcome!

> Before I get started, remember that there is a friendly channel on
> Freenode IRC network dedicated to dicussing Ada and creating a general
> sense of community around the language.  The channel population
> (around 60) would profit by any additional great conversation or
> insights that can be brought about.  Thanks!

Can you take a moment to explain why you find IRC better than a mailing
list/newsgroup?

I've tried them a few times, and just get frustrated with people not
thinking things thru.

With a newsgroup, people have time to think before they post.

I guess IRC feels more like being present; maybe I'm just too
anti-social.

Sorry, can't help with Ada aspects.

--
-- Stephe


 
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.
Jerrid Kimball  
View profile  
 More options Apr 25 2012, 10:25 am
Newsgroups: comp.lang.ada
From: Jerrid Kimball <jer...@kimball.co>
Date: Wed, 25 Apr 2012 09:25:47 -0500
Local: Wed, Apr 25 2012 10:25 am
Subject: Re: bindings with Ada 2012 aspects
Hi Stephen

I don't suggest that it is anything more than *another* useful avenue.
Responses can certainly be less well-formed and conflated with
non-germaine conversation.  Recognizing the latter, the channel
ameliorates by decreeing that on-topic conversation should take priority.

There are benefits of both forums.  Clearly for some, the disadvantages
of one can prevent them from using it.

I want the Ada community to flourish and if that means trying to drag it
from one out-dated technology to another I will!

Cheers

On 04/25/2012 07:09 AM, Stephen Leake wrote:


 
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.
Randy Brukardt  
View profile  
 More options Apr 25 2012, 9:47 pm
Newsgroups: comp.lang.ada
From: "Randy Brukardt" <ra...@rrsoftware.com>
Date: Wed, 25 Apr 2012 20:47:14 -0500
Local: Wed, Apr 25 2012 9:47 pm
Subject: Re: bindings with Ada 2012 aspects
"Jerrid Kimball" <jer...@kimball.co> wrote in message

news:jn7egd$scs$1@munin.nbi.dk...
...

> As I see it, a pragma Export should be directly replaceable by interfacing
> aspects' aspect marks and definitions:

> procedure Wait renames PO.Wait;
> pragma Export (C, Wait, "wait");

> becomes:

> procedure Wait renames PO.Wait
>    with Export => True, Convention => C, Link_Name => "wait";

> Am I looking at what should be submitted to ACT as a bug?

I believe this replacement is correct, except for one tiny detail:

No language-defined aspects are allowed on renames, and the above is a
renames.

The reason is that almost all language-defined aspects are the same for all
views of an entity, and a rename just introduces another view. Moreover,
this renames "trick" exists for pragmas simply to get around the limitations
of pragmas for overloaded entities, something that is totally unnecessary
for aspects.

I think in this particular case, you are trying to create a wrapper with
this renames (as opposed to "just" another view of the original subprogram).
I think that allowing the original pragma is dubious (although an
implementation is allowed to support Import and Export on anything they
like -- but it certainly is *not* portable).

So, I think you need to replace this subprogram renames by a real subprogram
(one that calls PO.Wait in it's body), and I suspect if you do that you'll
have no problems with the aspects.

                             Randy Brukardt, Editor, ISO/IEC 8652:tdb. :-)


 
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.
Jerrid Kimball  
View profile  
 More options Apr 27 2012, 4:23 pm
Newsgroups: comp.lang.ada
From: Jerrid Kimball <jer...@kimball.co>
Date: Fri, 27 Apr 2012 15:23:13 -0500
Local: Fri, Apr 27 2012 4:23 pm
Subject: Re: bindings with Ada 2012 aspects

On 04/25/2012 08:47 PM, Randy Brukardt wrote:

Thanks for that.  I hadn't considered that it would be unportable.
Frankly, I haven't read where pragma Export is actually valid, but shall
do so now.

> So, I think you need to replace this subprogram renames by a real subprogram
> (one that calls PO.Wait in it's body), and I suspect if you do that you'll
> have no problems with the aspects.

You may expect this, but the problem remains.  I failed to include my
other testing in my original post; it fails no matter what.  I'll
attempt on a newer wavefront as I can and update if I remember.


 
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.
Natasha Kerensikova  
View profile  
 More options May 2 2012, 8:38 am
Newsgroups: comp.lang.ada
From: Natasha Kerensikova <lithium...@gmail.com>
Date: Wed, 2 May 2012 12:38:05 +0000 (UTC)
Local: Wed, May 2 2012 8:38 am
Subject: Re: bindings with Ada 2012 aspects
Hello,

On 2012-04-26, Randy Brukardt <ra...@rrsoftware.com> wrote:

> No language-defined aspects are allowed on renames, and the above is a
> renames.

> The reason is that almost all language-defined aspects are the same for all
> views of an entity, and a rename just introduces another view. Moreover,
> this renames "trick" exists for pragmas simply to get around the limitations
> of pragmas for overloaded entities, something that is totally unnecessary
> for aspects.

I'm sorry to derail this thread a bit, but this interesting description
of renames makes we wonder even more why they are needed for public
subprograms implemented by generic instantiation. Like the following:

package Foo;

   procedure Bar (Arg_1 : in out Type_1; Arg_2 : in Type_2);

end Foo;

package body Foo

   generic
      type Formal_Type;
      with procedure Do_Stuff (Arg_2 : in Type_2);
   procedure Generic_Bar (Arg_1 : in out Formal_Type; Arg_2 : in Type_2);

   procedure Bar_Instance is new Generic_Bar (Type_1, Do_Real_Stuff);

   procedure Bar (Arg_1 : in out Type_1; Arg_2 : in Type_2)
      renames Bar_Instance;

end Foo;

What is so special about "just [introducing] another view" that cannot
be achieved by the more direct code below?

   procedure Bar is new Generic_Bar (Type_1, Do_Real_Stuff);

Thanks for your insights,
Natasha


 
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.
Randy Brukardt  
View profile  
 More options May 2 2012, 8:10 pm
Newsgroups: comp.lang.ada
From: "Randy Brukardt" <ra...@rrsoftware.com>
Date: Wed, 2 May 2012 19:10:15 -0500
Local: Wed, May 2 2012 8:10 pm
Subject: Re: bindings with Ada 2012 aspects
"Natasha Kerensikova" <lithium...@gmail.com> wrote in message

news:slrnjq2ake.1lme.lithiumcat@sigil.instinctive.eu...
...

> What is so special about "just [introducing] another view" that cannot
> be achieved by the more direct code below?

>   procedure Bar is new Generic_Bar (Type_1, Do_Real_Stuff);

This is a "renames-as-body", and it causes problems because you might have
conflicts between the aspects that are defined (explicitly or implicity) for
the specification, and those that are defined for the instance by the
generic definition. Other kinds of renames-as-body have fewer problems with
this.

You're *never* allowed to specify language-defined aspects on a body (of any
kind) [which is more about the original topic than your question].

In this specific case of Janus/Ada, the actual call profile of a generic
instantiation is different than the call profile of a non-generic subprogram
with the same set of parameters. So to make this work, there has to be a
wrapper or some other "connector" generated. Other implementations also have
various issues with this.

This is a lots of work, and it was never felt that this was common enough
that allowing it would make any real difference. That's because the vast
majority of generic units are packages, and this would do nothing to help
for a generic package instantiation. Maybe that judgement was wrong; but
even if the language was changed this would be low priority to change in
Janus/Ada simply because it would be a lot of work, and there are many other
projects which would have more benefit to our customers than this one.

It should be noted that this was decided during Ada 95, and it never has
been revisited since (to my knowledge), so perhaps it would make some sense
to revisit this for Ada 2020.

                                     Randy.


 
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 »