Re: [fpc-devel] Proposal: IIF - IfThen Cond True False
Em 12/01/2011 04:47, Marco van de Voort escreveu: In our previous episode, Paul Ishenin said: But even delphi does not have it for regular procedures/functions. I suppose because regular procedures/functions does not support overloading. ??? I use it all the time? Requires overload directive iirc, but works. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel Well guys, thanks for replying, the generic method is a very nice method, I personally didn't know that the FPC support it, very thank you for that! ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Proposal: IIF - IfThen Cond True False
Em 12/01/2011 05:00, Paul Ishenin escreveu: 12.01.2011 13:54, kingbiz...@gmail.com пишет: Well guys, thanks for replying, the generic method is a very nice method, I personally didn't know that the FPC support it, very thank you for that! FPC does not support it at the moment. I hope it will in a month. Best regards, Paul Ishenin ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel Ok, I'll be waiting for that! Guys, you reply fast and nice! Thank you again, anyways =) ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Variables declaraction inside code
Something that I always thought very nice on other languages is the possible of adding variables inside the codes, I'm very happy using the FPC but came on my mind, FPC is always getting better and better (I first saw it like 2 years ago and I am impressed with its progress), would it on the future be possible? Declaring variables after the begin? /*Just random thoughts*/ Thank you, Bizz ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Declare variables inside the code
*I have been playing on other languages sometimes and I see some features that speed-up a lot the code creating. I'm posting here one, I want to see what you think about it. * *Good:* fast algorithm testings, code creating *Bad?:* not a standard of the pascal language /*method* MyMethod; *var* A, B: Integer; *begin * { Simple sample of a variable inside the method begin/end near to a for-loop } *var* I: Integer; *for* I := a *to* b *do*... { Or even } *for* *var* J: Integer := a *to* b *do*... { This is normal on languages like C++ and Java } /*/end;/ * *What do you think about*? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Declare variables inside the code
Em 10/05/2011 18:50, Hans-Peter Diettrich escreveu: kingbiz...@gmail.com schrieb: *I have been playing on other languages sometimes and I see some features that speed-up a lot the code creating. I'm posting here one, I want to see what you think about it. * *Good:* fast algorithm testings, code creating *Bad?:* not a standard of the pascal language /*method* MyMethod; *var* A, B: Integer; *begin * { Simple sample of a variable inside the method begin/end near to a for-loop } *var* I: Integer; *for* I := a *to* b *do*... { Or even } *for* *var* J: Integer := a *to* b *do*... { This is normal on languages like C++ and Java } /*/end;/ * *What do you think about*? This could be made compatible with the FPC handling of Body, where e.g. a program or a procedure body is a Body, parsed by tcgprocinfo.parse_body(). The only required parser modification had to treat a For statement as a Body, with an (optional) specialized Var section at its begin, and a Statement after Do. But this solution would look strange to C coders, which expect variable declarations *after* the begin of an block, while Pascal expects local variables declared *before* the begin of an block. OTOH I don't think that it would be a big deal to allow for Pascal declarations also at the begin of an block. The syntax would look like: Block = "BEGIN" [Declarations] {Statement} "END" . DoDi ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel This already help, but what about declaring also after some code? I like on Java/C++/PHP that I can create a for-loop that creates the counter... sample on PHP: for(var; condition; step) for($var=0; $var<1000; $var += 1) This syntaxe is possible on C++, Java (its not equal, but its something very close). I would like to be able this: [ some code after begin ] DoSomething; var I: Integer; for I := 0 to 1000 do DoAnotherThing(I); [ inside the code ] ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Declare variables inside the code
Em 10/05/2011 18:29, Joerg Schuelke escreveu: Am Tue, 10 May 2011 23:50:29 +0200 schrieb Hans-Peter Diettrich: The syntax would look like: Block = "BEGIN" [Declarations] {Statement} "END" . Yea, it looks like C, but it is not. The difference in C like languages is that an declaration is just a kind of statement. Without this, I think it makes no sense. But then you code C-like with pascal keywords. Jörg ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel I don't see any disadvantage writting a code with /C-like with pascal keywords/, shortcuts are always welcome in order to code faster (also this is the objective of the High-Level Languages, isn't?). I like Pascal and I don't see why to resist against some improvements, the language gets richer and easier. Some small details can also increase the community. Lets see the OOP, its very helpful and speedup a lot the work and has been added to the Pascal. Same for generics. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Declare variables inside the code
Em 11/05/2011 17:01, Vinzent Höfler escreveu: On Wed, 11 May 2011 12:07:31 +0200, Hans-Peter Diettrich wrote: kingbiz...@gmail.com schrieb: I would like to be able this: [ some code after begin ] DoSomething; var I: Integer; for I := 0 to 1000 do DoAnotherThing(I); [ inside the code ] That's not good practice, in no programming language. Better move the loop into a local procedure, where you can declare really local variables. Or make the loop variable completely implicit and thus 100% local to the loop. |for i : integer := 0 to 1000 do ...; Vinzent. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel I like this idea, but I'm changing my mind,*maybe is better to keep the current way*, its not really needed to declare a variable inside the codes, its nice, I like it but its not really necessary. But something that has been pointed (by Joerg I belive) is the initialization of variables, what about it? This would be a nice thing and I don't see why not. I prefer to see: *var X: Integer = 0; Y: Integer = 100;* than *var X: Integer; Y: Integer; begin X := 0; Y := 100;* ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel