help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Possible Parser Issue


From: Mark Bratcher
Subject: RE: Possible Parser Issue
Date: Fri, 22 Jan 2021 15:42:12 -0500

Hi Gary

 

If you want floats, use “.0” at the end. Yes, the “..” at the end would be a syntax error. I think most compilers/interpreters, for a literal float, require at least one digit after the decimal point.

 

st> x := 0

0

st> x class

SmallInteger

st> x := 0.

0

st> x class

SmallInteger

st> x := 0.0

0.0

st> x class

FloatD

st>

 

Sent from Mail for Windows 10

 

From: Gary Highberger
Sent: Friday, January 22, 2021 3:27 PM
To: help-smalltalk
Subject: Possible Parser Issue

 

Hello,

In lines 10-14 below I think the parser is taking the decimal point to be a

period. If I add a period after the decimal point I get a compile error. No

biggie. Just letting everyone know.

 

1 Object subclass: PIDCntlr [

  2     | pgain igain dgain acc oldErr myName|

  3     PIDCntlr class >> new: name [

  4         | r |

  5         r := super new .

  6         r init: name .

  7         ^r.

  8     ]

  9     init: name [

10         pgain := 0.

11         igain := 0.

12         dgain :=0.

13         acc := 0.

14         oldErr := 0.

15         myName := name .

16     ]

17     wru [

18         ^myName

19     ]

20 ]

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]