[Info-vax] VMS Basic strings class D vs class S
Arne Vajhøj
arne at vajhoej.dk
Sun Feb 25 19:06:42 EST 2024
On 2/25/2024 6:55 PM, Dave Froble wrote:
> On 2/25/2024 4:33 PM, Arne Vajhøj wrote:
>> If I have understood it correctly then VMS Basic
>> strings use class D descriptors.
>>
>> That is very nice.
>>
>> But what happens if non-Basic code call Basic
>> code with a string using a class S descriptor?
>> For input/read? For output/write?
>>
>> Does the Basic runtime call some STR$ function that
>> understands the difference between S and D and handle
>> A properly? Or will I get a runtime error due to invalid
>> string?
>
> I don't know the correct answer, but, at a guess, whatever is called to
> handle the string quite likely will evaluate the descriptor and do "the
> right thing". That would be my bet. Otherwise, why have descriptors?
I am pretty sure that Basic will not corrupt anything, but handling it
and causing an exception would both be sort of acceptable behavior.
A trivial example works:
$ type f.for
program f
character*80 s
call b1('ABC')
call b2(s)
write(*,*) '|'//trim(s)//'|'
end
$ type b.bas
sub b1(string s)
print "|" + s + "|"
end sub
!
sub b2(string s)
s = "ABC"
end sub
$ for f
$ bas b
$ link f + b
$ run f
|ABC|
|ABC|
But I can't but wonder if it always works.
Arne
More information about the Info-vax
mailing list