gm2
[Top][All Lists]
Advanced

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

Re: Mistyped array literal causes compiler to emit traceback.


From: Gaius Mulley
Subject: Re: Mistyped array literal causes compiler to emit traceback.
Date: Sat, 03 Dec 2022 17:45:01 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Guy <guyfieri@getbackinthe.kitchen> writes:

> As I continue to try out the language/compiler, I've stumbled across
> another oddity that I wanted to ask about. I wanted to try networking
> via the ClientSocket and ServerSocket modules, while creating a test
> however it seems I mistyped a few things and made the compiler produce
> a stack traceback in two separate instances. While I am unsure of what
> exactly caused this to occur, I am hopefully fairly close.
>
> The first seems to be related to when I was using an array literal to
> define a constant. This was for the address the client socket was
> going to connect to, so the type was defined as an array of 4 chars to
> represent an IPv4 address. Not really thinking about syntax much, at
> first I accidentally used integer literals in the array literal. Upon
> attempting to compile, the compiler emitted what is attached in the
> file const_char_error.txt

Hi,

many thanks for the bug report - now fixed in the latest git.
(Although I've just seen the incorrect procedure name - which I'll fix!)

regards,
Gaius


$ gm2 -fiso badipv4.mod 
badipv4.mod:7:12: error: In procedure ‘ForeachIndiceInIndexDo’: expecting CHAR 
datatype and not ‘127’ a ‘Modula-2 base Z’ in the 0th component of the ‘IPV4’ 
array
    7 |   Loopback = IPV4 {127, 0, 0, 1} ;
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
badipv4.mod:7:12: error: expecting CHAR datatype and not ‘1’ a ‘Modula-2 base 
Z’ in the 3rd component of the ‘IPV4’ array
badipv4.mod:7:12: error: expecting CHAR datatype and not ‘0’ a ‘Modula-2 base 
Z’ in the 2nd component of the ‘IPV4’ array
badipv4.mod:7:12: error: expecting CHAR datatype and not ‘0’ a ‘Modula-2 base 
Z’ in the 1st component of the ‘IPV4’ array



reply via email to

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