develooper Front page | perl.perl6.language.data | Postings from August 2000

Re: 122 (v1): types and structures

Thread Previous | Thread Next
From:
David L. Nicol
Date:
August 24, 2000 12:53
Subject:
Re: 122 (v1): types and structures
Message ID:
39A57D1E.A4CC66B6@kasey.umkc.edu
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?

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About