Deutsch English Français Italiano |
<vggdhl$27v1j$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Thiago Adams <thiago.adams@gmail.com> Newsgroups: comp.lang.c Subject: Re: on named blocks concept Date: Wed, 6 Nov 2024 15:46:13 -0300 Organization: A noiseless patient Spider Lines: 94 Message-ID: <vggdhl$27v1j$1@dont-email.me> References: <4b9a47d628677882c26b2518a78571043ef1bdb9@i2pn2.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 06 Nov 2024 19:46:13 +0100 (CET) Injection-Info: dont-email.me; posting-host="ed0b0cca57889ee8a8eef5f7438bd1ef"; logging-data="2358323"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19KsQary/quH8FQMjQDSe5se3PqF1UlLkE=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:On8eXHVBH58eX9oFeKCs5BVKfKM= Content-Language: en-US In-Reply-To: <4b9a47d628677882c26b2518a78571043ef1bdb9@i2pn2.org> Bytes: 3502 On 06/11/2024 13:04, fir wrote: > if c would have something that i name as named block > much more interesting options in coding in c would be > imo avaliable.. > by named block i understood something like > > foo { > //code here > } > > whiuch resembles function , as can be placed in 'global' > (module level) space but also could be placed locally in > functions > > int foo() { > a { } > b { } > } > > then it could be called internally > > int foo() { > a { } > b { } > > int x = a()*a()*b(); //though imo () probab;ly should be optionall > } > > or externally > > foo.a() > > those blocks probably should have acces to local variables of > parent functions or parant block so it yelds imo to conclusion > that local variables and arguments should be by default static > (those stack variables by default are bad idea imo.. its kinda optimisation > needed whan you got 4kb RAM but on bigger machines this optimisation is > bad imo) > > if so mant things can be done with this blocks probably, im not exactly > sure what exactly > > ona assembly label blocks by defauld probably be done by > > name: > //... > ret > > so then can be reused though some version to call it in place > of definitions could be also avaliable imo (something like > a{}() in a sense but better looking (this looks to bad) > > overally those named block should be also united with function > so they become the same if use on them the functionality of > passing arguments and returning variables > > foo { > a {} > > int x, y = a(1,2) > } > > though i maybe not sure how to add this mechanism > possibly som,ething liek this (until something better could be found) > > a > { > in int c; > in int d; > out int x = c+d; > out int y = c-d; > } > > or > a( int c, int d) > { > out int x = c+d; > out int y = c-d; > } > > as all c d x y are static you may call a() without any or > with any set int x, y = a(1) int x = a(1,2) and compiler > would generate the assigments (how to call it on assembly level us > wuite clear, not fully clear is what syntax in language to use > > this concept is yet not fully build yet but what i descrbed her i guess > is okay Names loops (only loops) were proposed to C2Y. https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3355.htm