comp.lang.ada
 help / color / mirror / Atom feed
* REQ: Extend slices for n dimensional arrays for Ada 202X
@ 2017-01-26 13:29 Lucretia
  2017-01-26 14:01 ` Lucretia
  2017-01-26 18:29 ` Randy Brukardt
  0 siblings, 2 replies; 17+ messages in thread
From: Lucretia @ 2017-01-26 13:29 UTC (permalink / raw)


Hi,

Array slices are a very powerful feature of the language as it is right now, but the fact that they are limited to 1-dimensional arrays if short sighted. By having slices be applicable to all types of arrays would make memory copy operations much easier to do and would also eliminate possible array index calculation errors that we see in other languages.

Example:

When using my SDL bindings I would like to be able to copy a texture or sub-texture, be that 1D, 2D or 3D, from one texture to an area within another texture. As an example, this would be perfect for implementing a movie player, decode frame into buffer, e.g.

  Texture (x1 .. x2, y1 .. y2) := Buffer;  --  Buffer is the correct size.

Because these would be primitive types, there would be no way to provide an alternative copy operation which doesn't use the CPU, so I would suggest a new attribute to allow for this:

  for Texture_Type'Copy use GPU_Copy;

where GPU_Copy could be defined as:

  procedure GPU_Copy (Source : in out Texture_Type; Dest : in Texture_Type);

This is not just useful for games which can get quite low-level as can be seen, it could be used to implement DMA copying on an embedded system, or offloading to another MCU on the board.

Another point is that this could open Ada up even more into new areas of work, such as games. 

Luke.

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2017-01-28  9:08 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-26 13:29 REQ: Extend slices for n dimensional arrays for Ada 202X Lucretia
2017-01-26 14:01 ` Lucretia
2017-01-26 14:03   ` Lucretia
2017-01-26 14:52   ` Dmitry A. Kazakov
2017-01-27  9:19     ` Alejandro R. Mosteo
2017-01-27 14:04     ` Lucretia
2017-01-26 18:29 ` Randy Brukardt
2017-01-27  1:54   ` Robert Eachus
2017-01-27  5:39     ` Robert Eachus
2017-01-27 14:06     ` Lucretia
2017-01-27 23:30     ` Randy Brukardt
2017-01-28  0:58       ` Robert Eachus
2017-01-27  9:34   ` Dmitry A. Kazakov
2017-01-27 13:53     ` G.B.
2017-01-27 14:20       ` Dmitry A. Kazakov
2017-01-27 23:37       ` Randy Brukardt
2017-01-28  9:08         ` Dmitry A. Kazakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox