discuss-gnuradio
[Top][All Lists]
Advanced

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

RE: Is PMT_NIL a Valid Dictionary?


From: Jeff S
Subject: RE: Is PMT_NIL a Valid Dictionary?
Date: Thu, 30 Jun 2022 14:50:07 +0000

Awesome description, Jacob!  It’s been some time since I’ve had to be thinking at these lower levels, so I just need some oil on my mind.  I really appreciate the details from you and Jeff.  You both have saved me much time and confusion.

 

Regards

 

From: jacob <jacobgilbert@protonmail.com>
Sent: Thursday, June 30, 2022 9:43 AM
To: Jeff S <e070832@hotmail.com>
Cc: Jeff Long <willcode4@gmail.com>; discuss-gnuradio@gnu.org
Subject: RE: Is PMT_NIL a Valid Dictionary?

 

Hi Jeff

 

Just to help clarify this a bit, PMT_NIL is a valid PMT object (not to be confused with null​)

 

PMT Dictionary type objects are nested pairs, and empty dictionary type objects (from pmt::make_dict()​ for example) are literally represented as a single PMT_NIL object under the hood, so this is specifically checked for and passes is_dict()​. As dictionary items are added, the base dictionary (or empty dict / PMT_NIL object) gets paired with added key-value pairs. Its not the best possible implementation, but has served GR for some time. PMTs are getting a modernization / overhaul soon.

 

The is_pdu() check should abstract that oddness a bit.

 

Jacob

 

 

------- Original Message -------
On Thursday, June 30th, 2022 at 7:12 AM, Jeff S <e070832@hotmail.com> wrote:


Cool.  I appreciate the clarification.  I had always taken an empty dictionary as a dictionary object without data, and a NIL as not an object, and the two were different.  This helps my PDU checking.

 

And I also found the update I missed which added is_pdu(), which simplifies some of my checking.  So, even better!

 

Thanks for the help,

Jeff

 

From: Jeff Long <willcode4@gmail.com>
Sent: Thursday, June 30, 2022 8:02 AM
To: Jeff S <e070832@hotmail.com>
Cc: discuss-gnuradio@gnu.org
Subject: Re: Is PMT_NIL a Valid Dictionary?

 

Yes, an empty dict is NIL, so that is (confusingly) valid.

 

On Thu, Jun 30, 2022 at 7:05 AM Jeff S <e070832@hotmail.com> wrote:

GNU Radio Version:  v3.9.6.0-23-ge3506b13

 

I was writing a QA test and decided to try,

 

self.assertTrue(pmt.is_dict(pmt.PMT_NIL))

 

and it passes.  I was just wondering if pmt.PMT_NIL is considered a valid dictionary object, as opposed to,

 

my_dict = pmt.make_dict()

self.assertTrue(pmt.is_dict(my_dict))

 

Just trying to get a better understanding and couldn’t find an answer.

 

Regards,

Jeff

 


reply via email to

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