[J3] Ada contract model for generic packages

Ondřej Čertík ondrej at certik.us
Thu Mar 11 22:38:50 UTC 2021


Hi Bill

On Thu, Mar 11, 2021, at 3:18 PM, Bill Long via J3 wrote:
> Hi Ondrej,
> 
> I’m not sure what the example is trying to accomplish.  If it is to 
> print out a section of an array, that capability is already built into 
> Fortran. 

That example is showing how to use templates and requirements/restrictions/traits/concepts (whatever terminology you want to use) on a very simple example in each of the languages there (Go, C++, Rust, Haskell). And it shows that Go, Rust and Haskell use "strong restrictions" while C++ uses "weak restrictions". You can see in the error messages what the difference is in practice.

Since Van mentioned Ada, we can add it there as well --- I never used Ada, so I would have to learn, but if I have time, I'll try to add it.

> And example that actually did something would be more 
> illuminating.  Perhaps some mathematical computation that is not 
> already covered by one of the Fortran intrinsics. 

Indeed, I would like to have more examples. I agree something more mathematical would be more applicable to Fortran. I started with the example above because it was mentioned in the Go template document as an example how the "strong restrictions" work, so I used exactly the same example in all languages.

Do you have some good example in mind?

Ondrej


More information about the J3 mailing list