QuoteYou are ignorantnowi will get some.gin/tonic and wait for thaddy's reaponse and i will enjoy your slow convultions
You are ignorant
Parenthesis don't make a function call a function call. Pascal is a typed language, the fact that identifier is a function makes it a function call.
That's why in Delphi you have to do @SomeFuncName to get a pointer.
When you think about a function name, it can't be anything else than a POINTER to its code.
But if you want to treat a function's name as a pointer, you have to distinguish between a name as a pointer and a function invocation.So parenthesis for invocation must be mandatory. In this case you wouldn't need to use @ on a function's name.
Quote from: AlexK on July 14, 2017, 09:20:22 pmThat's why in Delphi you have to do @SomeFuncName to get a pointer.Your code compiles fine without the @.
Quote from: marcov on July 14, 2017, 09:33:58 pmQuote from: AlexK on July 14, 2017, 09:20:22 pmThat's why in Delphi you have to do @SomeFuncName to get a pointer.Your code compiles fine without the @.No, compiler calls the function "Hello" and passes to "Take" a string returned by "Hello".Code: Pascal [Select]Take(Hello);Error: Incompatible type for arg no. 1: Got "AnsiString", expected "<procedure variable type of function:AnsiString;Register>"
I've worked a little on implementing syntax highlighting for an FPC mode in Emacs.It turns out that Delphi's idiosyncrasies spoiled the language in some parts.For example, calling a proc/func without parenthesis: http://s5.postimg.org/oszmu72vb/fpc_mode_emacs.jpgOBJFPC style guidelines fix that, but are not enforced.It seams to me that such a language may replace C in open source.
Code: Pascal [Select]type TFuncNoArgsString = function(): String; // is it a pointer type? function Hello: String;begin Result := 'Hello There';end; procedure Take(f: TFuncNoArgsString);begin WriteLn( f() );end;
Alex, FPC-mode in Emacs? This is really a good one. Have you already upload the FPC-mode package to the melpa repo? I would really like to try it .
If we want Lazarus to become the major platform, we need our own multi-platform, OpenGL GUI.