From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id A4B0059CA3 for ; Tue, 15 Mar 2016 22:37:14 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EF3A6E0850; Tue, 15 Mar 2016 22:37:11 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4FCA4E084C for ; Tue, 15 Mar 2016 22:37:11 +0000 (UTC) Received: from [10.128.12.197] (unknown [100.42.98.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: zmedico) by smtp.gentoo.org (Postfix) with ESMTPSA id 1895F340BD1 for ; Tue, 15 Mar 2016 22:37:10 +0000 (UTC) Subject: Re: [gentoo-portage-dev] [Patch] Repoman rewrite stage2 modularization conversion complete To: gentoo-portage-dev@lists.gentoo.org References: <20160110134008.4fce78c0.dolsen@gentoo.org> <5693CCAF.7020102@gentoo.org> <20160305133705.42b54258.dolsen@gentoo.org> <56E6F167.4050806@gentoo.org> <56E6F343.80005@gentoo.org> <20160314105256.37fb8e90.dolsen@gentoo.org> <56E754D3.5080308@gentoo.org> <20160314174710.4b6ebd1e.dolsen@gentoo.org> <56E75FB8.9060802@gentoo.org> <20160315120457.631e1dd3.dolsen@gentoo.org> <56E864B6.9060308@gentoo.org> <56E865BB.6040502@gentoo.org> <20160315131731.2edf502d.dolsen@gentoo.org> <56E86FB5.5080208@gentoo.org> <56E8711C.4070407@gentoo.org> <20160315135751.166ba608.dolsen@gentoo.org> <56E878AD.8020209@gentoo.org> <20160315141956.27b53de2.dolsen@gentoo.org> From: Zac Medico Message-ID: <56E88E8F.5090907@gentoo.org> Date: Tue, 15 Mar 2016 15:37:03 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 In-Reply-To: <20160315141956.27b53de2.dolsen@gentoo.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Archives-Salt: 7871d48b-e7ce-433c-9491-063c52ed71a2 X-Archives-Hash: 368025c89cd171577400caf0123be438 On 03/15/2016 02:19 PM, Brian Dolbec wrote: > On Tue, 15 Mar 2016 14:03:41 -0700 > Zac Medico wrote: > >> On 03/15/2016 01:57 PM, Brian Dolbec wrote: >>> On Tue, 15 Mar 2016 13:31:24 -0700 >>> Zac Medico wrote: >>> >>>>> >>>>> Also, now that we are using Fuse, can't we stop returning things >>>>> from these functions entirely, so that dynamic_data is only >>>>> updated by side-effects? >>>>> >>>> >>>> I think 'continue' is the only one left. We could just return a >>>> single boolean, or use an exception to do what 'continue' does. >>> >>> NOPE :( not without a lot more work... >>> >>> arches.py: return {'continue': False, 'arches': arches} >>> depend.py: return {'continue': False, 'unknown_pkgs': unknown_pkgs, >>> 'type_list': type_list, 'badlicsyntax': badlicsyntax, >>> 'baddepsyntax': baddepsyntax} >>> ebuild.py: return {'continue': False, 'ebuild': self} >>> return {'continue': False, 'pkg': self.pkg} >>> isebuild.py: return {'continue': self.continue_, 'pkgs': pkgs, >>> 'can_force': not self.continue_} >>> live.py: return {'continue': False, >>> 'live_ebuild': LIVE_ECLASSES.intersection( >>> kwargs.get('ebuild').inherited)} >>> fetches.py: return {'continue': False, 'src_uri_error': >>> self._src_uri_error} >>> pkgmetadata.py: return {'continue': False, 'muselist': >>> frozenset(self.musedict)} >>> return {'continue': False, 'muselist': >>> frozenset(self.musedict)} >>> scan.py: return {'continue': False, 'eadded': >>> self.vcs_settings.status.eadded} >>> use_flags.py: return {'continue': False, 'ebuild_UsedUseFlags': >>> self.usedUseFlags, 'used_useflags': >>> used_useflags} >>> >>> >>> But we can define a generic dynamic_data class that holds the >>> data that can be modified in a similar way to the Fuse class. That >>> way we don't have to update it like we do a dictionary. >>> >> >> Can't we add all these things to the dynamic_data dict that's >> initialized in Scanner.scan_pkgs (along with Fuse instances), and just >> let them get passed in as arguments, so that the functions can act on >> them without having to return them? > > Yeah, /me is being a dummy. The modules are currently being passed > the dict as a **kwargs. So the individual attributes are accessible > directly. We could just pass it as one arg instead then the modules can > just modify the dictionary directly since it is passed in by pointer. Multiple args work fine too, as long as those args refer to mutable instances that persist outside the function. > Sorry, my head is bouncing back and forth between this and other work > code... But I like how we're getting the code in better shape... > something I had reserved for stage3 ;) I just feel like each step should result in code that is more maintainable than the last, and in the current step we have gone somewhat backwards in maintainability in a specific area. > The current method is the first > thing that came to me when I discovered I needed to get new data back > into the dynamic_data for trailing modules in the queue. You can see how the new approaches we are coming up with are much more maintainable and easier for people to wrap their heads around. -- Thanks, Zac