Re: 122 (v1): types and structures

[email protected] ("David L. Nicol")
Newsgroups perl.perl6.language.data
Organization University of Missouri - Kansas City supercomputing infrastructure
Message-ID <[email protected]>
Tom Christiansen wrote:
> 
> >Tom Christiansen wrote:
> 
> >> C type declarations are pretty universally despised.
> 
> >By whom?
> 
> >This is news to me.  I have always thought that the C type declaration
> >is a concise and platform-independent way of declaring a packed
> >structure, and effectively hiding implementation details (offsets into it)
> >from the programmer.
> 
> >What is wrong with them, that makes them despicable?
> 
> Hiding the padding means that two compilers might not be able
> to get at the same thing.

So you don't have a problem with the idea as a whole, you just
think the rough edges could use some polishing. I left portability
issues out of my "adopt C struct syntax" suggestion, expecting a
later conversation or ruling to resolve it:  Either we inherit
the quirks of the compiler we're built with or we define a perl-specific
mapping, or both, through something invisible to the langauge user.

The reference implementation, built in perl5, will be inheriting
its :int type from the SVt_IV I think.


> If you've ever tried to properly declare signal(3), you'll
> see the main pain I was thinking about:
> 
>     void  (*signal (int, void (*) (int))) (int);

What would an improved way to declare a function that takes
two arguments, one a pointer to a function that takes two
arguments not described in this sentence and the other an integer?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.