Re: [fpc-pascal] $modeswitch declared before $mode fails without warning
Am 18.09.2022 um 15:39 schrieb Hairy Pixels via fpc-pascal: On Sep 18, 2022, at 7:37 PM, Florian Klämpfl via fpc-pascal wrote: This is in general the case that $mode overrides all previously set switches i.e. it simply sets the switches as defined by the given mode so I am not sure if this is really worth a warning. Is there ever a time where this would be useful to put a mode switch before the mode? I always think about it like a 2 step process: 1) choose the mode and 2) add extra features via mode switches. Unless I’m missing some use case it just seems like a way to create bugs. The thing is that it is not necessary to use a mode directive. Either the user might be happy with the default mode FPC and just add some modeswitch for extended functionality or the mode might be provided as a command line parameter again with adding some special functionality. And it would be much more effort to keep track of when a modeswitch directive was used in case a mode directive is used later on. Just not worth the effort as it's documented that a mode directive resets any modeswitches. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] $modeswitch declared before $mode fails without warning
> On Sep 18, 2022, at 7:37 PM, Florian Klämpfl via fpc-pascal > wrote: > > This is in general the case that $mode overrides all previously set switches > i.e. it simply sets the switches as defined by the given mode so I am not > sure if this is really worth a warning. Is there ever a time where this would be useful to put a mode switch before the mode? I always think about it like a 2 step process: 1) choose the mode and 2) add extra features via mode switches. Unless I’m missing some use case it just seems like a way to create bugs. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] $modeswitch declared before $mode fails without warning
Am 18.09.22 um 14:22 schrieb Hairy Pixels via fpc-pascal: One more thing today working with closures. Declaring the modeswitch before the mode does not actually enable the feature and gives no warning. What happens then is basic syntax fails and you’re totally confused as to why. Shouldn’t this be illegal or give a warning at least? {$modeswitch functionreferences} {$modeswitch anonymousfunctions} {$mode objfpc} This is in general the case that $mode overrides all previously set switches i.e. it simply sets the switches as defined by the given mode so I am not sure if this is really worth a warning. program test; var p: reference to procedure; begin end. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] $modeswitch declared before $mode fails without warning
One more thing today working with closures. Declaring the modeswitch before the mode does not actually enable the feature and gives no warning. What happens then is basic syntax fails and you’re totally confused as to why. Shouldn’t this be illegal or give a warning at least? {$modeswitch functionreferences} {$modeswitch anonymousfunctions} {$mode objfpc} program test; var p: reference to procedure; begin end. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal