Re: Arrays

2021-10-18 Thread Duke Normandin
On Tue, 19 Oct 2021 10:07:43 +1100
Chris Angelico  wrote:

[snip]

> > set warnings strict

That worked swell in my Hilfe! Thx
--
Duke



Re: Arrays

2021-10-18 Thread Duke Normandin
On Tue, 19 Oct 2021 10:07:43 +1100
Chris Angelico  wrote:

> On Tue, Oct 19, 2021 at 10:03 AM Duke Normandin
>  wrote:
> >
> > On Tue, 19 Oct 2021 09:26:34 +1100
> > Chris Angelico  wrote:
> >
> > > On Tue, Oct 19, 2021 at 9:19 AM Duke Normandin
> > >  wrote:
> > > >
> > > > Pike v8.0 release 702 running Hilfe v3.5 (Incremental Pike
> > > > Frontend)
> > > >
> > > > > array(string) flat = ({"this", "that", "the", "other"});
> > > > > flat[1];(4) Result: "that"
> > > >
> > > > > flat[1]=3;
> > > > (5) Result: 3
> > > >
> > > > > flat[1];
> > > > (6) Result: 3
> > > >
> > > > I was under the impression that array(string) would exclude
> > > > any other data types but strings.
> > > >
> > > > What's going on?
> > >
> > > It doesn't work in Hilfe, but "#pragma strict_types" will
> > > flag a script as wanting more stringent type checking, and
> > > will flag assignments like that.
> >
> > Do you mean that the #pragma can be used in Hilfe as well as
> > scripts? Or just in scripts?
>
> Pragmas don't directly work in Hilfe, but you can use this
> directive to enable strict_types:
>
> > set warnings strict
>
> Unfortunately, the version of Pike I'm using (a trunk build of
> 8.1.14) has a lot of spurious warnings from strict_types, so I
> tend not to use it. But if it works for you, then go for it.

I found out for myself that pragmas don't work in Hilfe - but
thanks for confirming it and for the alternate option. I'll give it
a try.

I work with emacs most of the time, so I'm trying to figure out a
slick workflow to learn with. Doing the learning code in Hilfe is
great, but if it's limited than it might cause more confusion which
I don't need.

Thanks agian ..
--
Duke



Re: Arrays

2021-10-18 Thread Chris Angelico
On Tue, Oct 19, 2021 at 10:03 AM Duke Normandin  wrote:
>
> On Tue, 19 Oct 2021 09:26:34 +1100
> Chris Angelico  wrote:
>
> > On Tue, Oct 19, 2021 at 9:19 AM Duke Normandin
> >  wrote:
> > >
> > > Pike v8.0 release 702 running Hilfe v3.5 (Incremental Pike
> > > Frontend)
> > >
> > > > array(string) flat = ({"this", "that", "the", "other"});
> > > > flat[1];(4) Result: "that"
> > >
> > > > flat[1]=3;
> > > (5) Result: 3
> > >
> > > > flat[1];
> > > (6) Result: 3
> > >
> > > I was under the impression that array(string) would exclude any
> > > other data types but strings.
> > >
> > > What's going on?
> >
> > It doesn't work in Hilfe, but "#pragma strict_types" will flag a
> > script as wanting more stringent type checking, and will flag
> > assignments like that.
>
> Do you mean that the #pragma can be used in Hilfe as well as
> scripts? Or just in scripts?

Pragmas don't directly work in Hilfe, but you can use this directive
to enable strict_types:

> set warnings strict

Unfortunately, the version of Pike I'm using (a trunk build of 8.1.14)
has a lot of spurious warnings from strict_types, so I tend not to use
it. But if it works for you, then go for it.

ChrisA



Re: Arrays

2021-10-18 Thread Duke Normandin
On Tue, 19 Oct 2021 09:26:34 +1100
Chris Angelico  wrote:

> On Tue, Oct 19, 2021 at 9:19 AM Duke Normandin
>  wrote:
> >
> > Pike v8.0 release 702 running Hilfe v3.5 (Incremental Pike
> > Frontend)
> >
> > > array(string) flat = ({"this", "that", "the", "other"});
> > > flat[1];(4) Result: "that"
> >
> > > flat[1]=3;
> > (5) Result: 3
> >
> > > flat[1];
> > (6) Result: 3
> >
> > I was under the impression that array(string) would exclude any
> > other data types but strings.
> >
> > What's going on?
>
> It doesn't work in Hilfe, but "#pragma strict_types" will flag a
> script as wanting more stringent type checking, and will flag
> assignments like that.

Do you mean that the #pragma can be used in Hilfe as well as
scripts? Or just in scripts?
--
Duke



Re: Arrays

2021-10-18 Thread Chris Angelico
On Tue, Oct 19, 2021 at 9:19 AM Duke Normandin  wrote:
>
> Pike v8.0 release 702 running Hilfe v3.5 (Incremental Pike Frontend)
>
> > array(string) flat = ({"this", "that", "the", "other"});
> > flat[1];(4) Result: "that"
>
> > flat[1]=3;
> (5) Result: 3
>
> > flat[1];
> (6) Result: 3
>
> I was under the impression that array(string) would exclude any
> other data types but strings.
>
> What's going on?

It doesn't work in Hilfe, but "#pragma strict_types" will flag a
script as wanting more stringent type checking, and will flag
assignments like that.

ChrisA