1. ?"Hello"&-1
- Posted by petelomax Apr 03, 2021
- 844 views
There have been a few releases of Phix now with ?{65,66,67} printing {65,66,67} instead of {65'A',66'B',67'C'}.
Conversely pp({65,66,67}) has been printing {65'A',66'B',67'C'} and I've had to use pp({65,66,67},{pp_IntCh,false}) to get {65,66,67}.
I'm going to flip that behaviour back, and make pp_IntCh default to false - any objections? (I'll be slightly surprised if there are...)
Proposed new behaviour:
?{65,66,67} -- {65'A',66'B',67'C'} \ these were pp({65,66,67},{pp_IntCh,false}) -- {65,66,67} / flipped pp({65,66,67}) -- {65,66,67} pp({65,66,67},{pp_IntCh,-1}) -- {'A','B','C'} pp({65,66,67},{pp_IntCh,true}) -- {65'A',66'B',67'C'} -- previous default
Obviuously actual strings were and still are shown as actual strings:
?"Hello" -- "Hello" pp("Hello") -- `Hello`
(pp() now prefers backticks over doublequotes to minimise excessive escaping)
2. Re: ?"Hello"&-1
- Posted by _tom (admin) Apr 05, 2021
- 686 views
In a tutorial, extraneous arguments is a pain--? is great for that reason.
In OE|Phix you have to show the dual nature of integers|characters--pp( is great for that reason.
The leading argument in puts( and print( is a ''slight nuisance''.
In a tutorial, this kind of output has to be emphasized:
? {65,66,67} pp( {65,66,67} ) puts(1, {65,66,67} )
{65,66,67} {65'A',66'B',67'C'} ABC
In a conventional language, print seems to do it all. This gives the illusion that a conventional language is ''easy''.
Tutorial inspired ideas:
- flip arguments
- print( "hello", 1)
- print( "hello", fn )
- pp( needs positional arguments
- pp( "hello", IntCh:=True )
- ''ln'' suffix as in pasacal
- puts(
- putsln(
- write( writeln( as a tutorial friendly cross between ? and pp(
- output in OE|Phix has some dark corners that needs exploring
You can always create a butterfly effect for any change in a language.
be well
_tom