Subscribe

2019-03-28 Thread PM

Hello PM  :-)
You are now subscribed




--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Making json.l parse floating point

2019-03-28 Thread C K Kashyap
Super  that works like a charm ... I'll create a PR :)

On Thu, Mar 28, 2019 at 7:56 AM Alexander Burger 
wrote:

> Hi Kashyap,
>
> > Regarding the (local) - I'll take a look if I can produce a Pull Request
> > with the fix. I wonder though if it has anything to do with the "problem
> > with namespace" mentioned under the "Usage" section of
> > https://github.com/aw/picolisp-json
>
> Yes, indeed. This must be one reason. With PicoLisp version 17.3.4 (the
> corresponding entry in doc/ChangeLog is "04mar17, Namespace chaining
> instead of
> merging") the namespace system was completely rewritten. The former
> experimental
> way of using namespaces turned out impractical, but the current one,
> chaining
> namespaces into a search order (analog to Forth "vocabularies"), is very
> useful.
> I use it a lot in my projects.
>
>
> Concerning json.l, one critical point may be that this lib seems to be
> intended
> also for pil32 and thus should load also without namespace support.
>
> For that I would recommend the following solution:
>
>(unless (== 64 64) (from ""))
>
>(symbols 'json 'pico)
>
>(local) (MODULE_INFO *Msg err-throw json-parse-file json-parse-string
>json-parse-unicode json-count-brackets json-array-check
> json-object-check
>json-object-check-separator link-generic link-array link-object
>link-object-value iterate-object iterate-list make-null make-boolean
>make-json-number make-json-string make-json-array make-generic
> make-object
>make-array)
>
>
>
> This skips (i.e. does not read) the whole symbols stuff. The list following
> (local) should contain all symbols private in this lib.
>
> Let me know if you need further input.
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Making json.l parse floating point

2019-03-28 Thread Alexander Burger
Hi Kashyap,

> Regarding the (local) - I'll take a look if I can produce a Pull Request
> with the fix. I wonder though if it has anything to do with the "problem
> with namespace" mentioned under the "Usage" section of
> https://github.com/aw/picolisp-json

Yes, indeed. This must be one reason. With PicoLisp version 17.3.4 (the
corresponding entry in doc/ChangeLog is "04mar17, Namespace chaining instead of
merging") the namespace system was completely rewritten. The former experimental
way of using namespaces turned out impractical, but the current one, chaining
namespaces into a search order (analog to Forth "vocabularies"), is very useful.
I use it a lot in my projects.


Concerning json.l, one critical point may be that this lib seems to be intended
also for pil32 and thus should load also without namespace support.

For that I would recommend the following solution:

   (unless (== 64 64) (from ""))

   (symbols 'json 'pico)

   (local) (MODULE_INFO *Msg err-throw json-parse-file json-parse-string
   json-parse-unicode json-count-brackets json-array-check json-object-check
   json-object-check-separator link-generic link-array link-object
   link-object-value iterate-object iterate-list make-null make-boolean
   make-json-number make-json-string make-json-array make-generic make-object
   make-array)

   

This skips (i.e. does not read) the whole symbols stuff. The list following
(local) should contain all symbols private in this lib.

Let me know if you need further input.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Making json.l parse floating point

2019-03-28 Thread C K Kashyap
Thans Alex,
Regarding the (local) - I'll take a look if I can produce a Pull Request
with the fix. I wonder though if it has anything to do with the "problem
with namespace" mentioned under the "Usage" section of
https://github.com/aw/picolisp-json
Regards,
Kashyap



On Wed, Mar 27, 2019 at 11:51 PM Alexander Burger 
wrote:

> Hi Kashyap,
>
> > I made a tiny change to support floating point (to be used with scaling
> > that is). I wanted to get it reviewed to confirm if I am not missing
> > something.
> >
> > I added a condition to  json-parse-unicode in json.l
> > 
>
> If you mean this line
>
> > [*(and (= "." (car Value))) (pop 'Value)  (link R '. (pop
> > 'Value)) ]*
>
> I think it is fine, though I have not studied the whole JSon library.
>
> A minor improvement could be to replace all calls like (pop 'Value) with
> (++ Value) which is a tiny little bit smaller and faster, but that's only
> cosmetics.
>
>
> But what REALLY nags me is that this code is still around:
>
>   (local MODULE_INFO *Msg err-throw)
>   (local json-parse-file json-parse-string json-parse-unicode
> json-count-brackets)
>   ...
>
> This is WRONG!! It is a pity that this is still public and being
> propagated as
> an example! Please don't use it!
>
> The correct syntax is:
>
>   (local) (MODULE_INFO *Msg err-throw)
>   (local) (json-parse-file json-parse-string json-parse-unicode
> json-count-brackets)
>   ...
>
> 'local' takes NO arguments. It must read the symbols from the input stream.
> Otherwise the symbols ARE already read when 'local' runs and will possibly
> be found in the wrong namespace.
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>