On 29-11-2022 10:13, Francis Grizzly Smit wrote:

Hi Francis,

Personally I never use \name are I hate how it looks, and so far I have never needed it, so unless I can find something it can do that I cannot do any other way, I'll keep on not using it

To show an example where I could use it I have defined a series of types in the Gnome packages of mine and could then use it everywhere as a type. The glib has several types defined which I wanted to use in my code so that I can cut and paste the code from the C source into Raku source without much changes.

There is a file defined in Gnome::N where a list of types is defined
…
constant \gboolean        is export = int32;
constant \gchar           is export = int8;
constant \gdouble         is export = num64;
constant \gfloat          is export = num32;
constant \gint            is export = int32;
…


And later in other modules I could then use these definitions, here for example 'gint'.

…
sub gtk_widget_add_events (
  N-GObject $widget, gint $events
) is native(&gtk-lib)
  { * }
…

The types file is generated to cope with int sizes differing on several implementations. E.g. a long int could be 32 or 64 bits depending on the implementation or OS or chip or ….

Reply via email to