Subj : Javascript weirdness To : All From : deon Date : Sun Apr 17 2022 20:21:22 Howdy, Hoping somebody could help me understand something unusual that's happening wth Javascript. I think it's a bug, but who knows somebody might see the err of my ways. I have created an object "MsgArea" which represents a message area and the ability to get a list of "tagged" messages and "untagged" messages. Here is the relevant part of the object: ==== function MsgArea() { this.msgbase = undefined; this.headers = undefined; this.tagged_list = undefined; this.untagged_list = undefined; const PAGE_LENGTH = 4; // The size of our page tag. const PAGE_LAST_KEY = 'last_page'; Object.defineProperty(this,'code',{ set: function(code) { this.msgbase = new MsgBase(code); if (! this.msgbase.open('r')) { writeln(ma.areas[i].code+' cannot be opened?'); exit(2); } this.headers = this.msgbase.get_all_msg_headers(false,false); this.msgbase.close(); } }); // Total tagged messages Object.defineProperty(this,'list_tagged',{ get: function() { if (this.tagged_list === undefined) { this.tagged_list = []; if (! this.headers) return this.tagged_list; for(var x in this.headers) { if (this.headers[x].tags && (this.headers[x].tags.length === PAGE_LENGTH)) { this.tagged_list.push(this.headers[x]); write(); // Needed else this is not working? } } } return this.tagged_list; } }); ==== I'm seeing two problems: 1) If I use: var x = new MsgArea(); x.code = 'PVT_TEST'; writeln('Tagged Messages: '+x.list_tagged.length); It reports 36 (which is correct). If I comment out the "write()" in the function list_tagged, it reports 25. Why? (And I have confirmed that 23 of the 25 do have a "tags" header.) 2) The other 2 messages of the 25 I cannot set a "tags" value in the header - the function put_msg_header() returns an error, but no details. Here is one of those message headers (in which I set the tags header to "1829"): {"number":27,"tags":"1829","to":"Clearing Houz","subject":"Address Link Code","from":"Hub Robot","from_net_type":2,"from_net_addr":"10:1/1","id":"<625A907B.27.pvt_test@mybbs.com>","ftn_area":"PVT_TEST","date":"Fri, 25 Mar 2022 11:05:08 +1100","attr":0,"votes":0,"auxattr":0,"netattr":0,"when_written_time":1648166708,"when_written_zone":660,"when_imported_time":1650102395,"when_imported_zone":0,"thread_id":27,"thread_next":0,"thread_first":0,"delivery_attempts":0,"field_list":[{"type":160,"data":"RESCANNED 10:1/1@private"},{"type":162,"data":"1/1 998"},{"type":163,"data":"1/1"}],"offset":26,"type":0,"version":768,"when_written_zone_offset":660,"when_imported_zone_offset":0,"thread_back":0,"data_length":869,"text_length":869,"upvotes":0,"downvotes":0,"total_votes":0,"is_utf8":0,"can_read":true} Why does the update header error? ....лоеп --- ю Synchronet ю Alterant | an SBBS in Docker on Pi! * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705) .