Your example produces the result shown for me, gt6 = {'cylinder': 6, 'manufacture': 'Triumph'}
without installing the patch. What is happening for you? On 5/20/06, Richard Emberson <[EMAIL PROTECTED]> wrote:
Just an FYI, I've just submitted a demonstration patch that allows one to do dictionary function chaining. Some of you might be interested in extending the patch to include value access via applying a key to the results of a function (if the function returns a dictionary). RME Text to bug report: This concerns functions and dictionaries While bug: 1491613 is a true error in the existing code, this bug is more of an enhancement. Currently if a function returns a dictionary, one can not call a function on that returned dictionary (or access a value via a key) inline: let v = dict1.getDict2().getValue() ( Note: the include patch does not address the following: let v = dict1.getDict2().somekey let v = dict1.getDict2()[somekey] ) With this patch the following code: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " " example of function chaining " let gt6 = {'cylinder': 6, 'manufacture': "Triumph" } let twodoor = {'sunbeam': "sunbeam", 'gt6': gt6 } function twodoor.getGt6() dict return self.gt6 endfunction let fourdoor = {'stationwagon': "stationwagon", 'sedan': "sedan" } let cars = {'twodoor': twodoor, 'fourdoor': fourdoor } function cars.getTwodoor() dict return self.twodoor endfunction function cars.getFourdoor() dict return self.fourdoor endfunction let pickup = {'ford': "Ford", "toyota": "Toyota" } let van = {'ford': "Ford", "gm": "GM" } let trucks = {'pickup': pickup, "van": van } function trucks.getPickup() dict return self.pickup endfunction function trucks.getVan() dict return self.van endfunction let vehicles = {'cars': cars, "trucks": trucks } function vehicles.getCars() dict return self.cars endfunction function vehicles.getTrucks() dict return self.trucks endfunction echo "gt6 = " . string(vehicles.getCars().getTwodoor().getGt6()) XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX produces the the following: gt6 = {'cylinder': 6, 'manufacture': 'Triumph'} The included patch is more of a demonstration of what can be done (it also includes the patch associated with bug 1491613). It only allows for mult-level function chaining. In addition, I am certain that its not the correct way to implement this feature. -- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.