(j3.2006) Unlimited polymorphic and LOCK_TYPE (and EVENT_TYPE)

Malcolm Cohen malcolm
Mon Jun 2 20:04:26 EDT 2014


Hi Bill,

Interesting new example....

>class(*),allocatable :: myevent[:]
>?
>allocate (event_type :: myevent[*] )

I don't offhand see any problem with this code, even without MYEVENT being a 
coarray, but then again it also does not achieve anything.  The only way you can 
achieve anything is to follow it up with something like

  SELECT TYPE (letter=>myevent) ! Renaming merely for exposition.
  TYPE IS (event_type)
    POST letter

at which point my previous reasoning comes into play: the construct entity 
LETTER is declared to be of type EVENT_TYPE and is therefore required to be a 
coarray; in your example it is (construct entities have the same corank and 
cobounds as the selector), so the code would be ok.  If myevent were not a 
coarray, the ALLOCATE would be ok (as in, would not fail any current constraint) 
but any attempt to actually use it as an event variable is inevitably going to 
run afoul of the "required to be a coarray" constraint.

That is certainly what we would seem to have for LOCK_TYPE.  It could be argued 
that this was unintentional (since it is useless) and that therefore we ought to 
have had a constraint on it in F2008.  That would be interp fodder if so.  For 
EVENT_TYPE we are not constrained by what we did in F2008 but for consistency it 
is probably good to make it similar to LOCK_TYPE except in so far as it is 
different because it is an event not a lock.

Cheers,
-- 
................................Malcolm Cohen, Nihon NAG, Tokyo. 




More information about the J3 mailing list