Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-11

Q: Compiler features as a service to Lazarus

8 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Anthony Walter

I have a tangential question related to Sven's new generic features and thought it deserved its own thread.

Would it be possible to expose the compiler's syntax checking as an engine to coding environments?

I find it frustrating that with all the great features add to the compiler (Sven recent generic functions for example) that it takes months or years for them to be properly supported by CodeTools. (I believe CodeTools provides its own parser apart from the compiler)

It is very frustrating to try to use a language feature and with the press of an editor command like Ctrl+Space (for code insight), Ctrl+Shift+C (for code completion), Ctrl+Shift+Up/Down (navigate interface/implementation) I am thrown out of whatever I was doing. Then I'm typically confronted with many CodeTools error complaints, which in fact are not errors, just language enhancements CodeTools has yet been extended to support.

Wouldn't it be possible, or perchance even preferable, if the compiler was exposed as a service? Exposed as a service so that coding environments like the Lazarus IDE (and by extension CodeTools) could use the compilers services service to advise users what is or is not illegal syntax, as well as enhanced code insight, code completion, tooltips, and more?

A quick google for "compiler as IDE service" reveals this is not a new idea in general programming circles:

**This tutorial demonstrates how to use the editor services provided by the compiler. This API is used to provide auto-complete, tool-tips, parameter info help, matching of brackets and other functions in editors including Visual Studio, Xamarin Studio and Emacs.**

http://fsharp.github.io/FSharp.Compiler.Service/editor.html

If they can do it, why can't we?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151124/9b460c0c/attachment.html>

Reply by email

Michael Van Canneyt
to Anthony Walter
Anthony Walter wrote
I have a tangential question related to Sven's new generic features and thought it deserved its own thread.

[snip]

Show quoted text 8 lines
**This tutorial demonstrates how to use the editor services provided by the compiler. This API is used to provide auto-complete, tool-tips, parameter info help, matching of brackets and other functions in editors including Visual Studio, Xamarin Studio and Emacs.** http://fsharp.github.io/FSharp.Compiler.Service/editor.html If they can do it, why can't we?

Because
1. We don't want to.
The amount of work needed to accomplish that is prohibitive. The compiler structure is currently entirely unsuitable for this purpose.

2. The codetools continue to work even if the sources do not compile. Not always, but often.
This is simply not possible if you use the compiler itself.

And I think you highly exaggerate the amount of time it takes for Mattias to enable new features in the IDE codetools. If he is aware of a new feature, it generally is added to the IDE very quickly.

On the whole, I tend to see the current situation as a plus, rather than a minus.

Michael.

Reply by email

Sven Barth
to Michael Van Canneyt
"Michael Van Canneyt" wrote 13 lines
On Tue, 24 Nov 2015, Anthony Walter wrote: > I have a tangential question related to Sven's new generic features and > thought it deserved its own thread. [snip] > **This tutorial demonstrates how to use the editor services provided by

the

Show quoted text 12 lines
> compiler. This API is used to provide auto-complete, tool-tips, parameter > info help, matching of brackets and other functions in editors including > Visual Studio, Xamarin Studio and Emacs.** > > http://fsharp.github.io/FSharp.Compiler.Service/editor.html > > If they can do it, why can't we? Because 1. We don't want to. The amount of work needed to accomplish that is prohibitive. The compiler structure is currently entirely unsuitable for this

purpose.

Show quoted text 6 lines
2. The codetools continue to work even if the sources do not compile. Not always, but often. This is simply not possible if you use the compiler itself. And I think you highly exaggerate the amount of time it takes for Mattias

to enable new features in the IDE codetools. If he is aware of a new feature, it generally is added to the IDE very quickly.

On the whole, I tend to see the current situation as a plus, rather than

a minus.

Plus there are no services of the compiler you could ask. The compiler is highly integrated and not even the textmode IDE - which has the compiler statically compiled - in can do this.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151124/8bf5424c/attachment.html>

Reply by email

Michael Van Canneyt
to Sven Barth
Sven Barth wrote 12 lines
Am 24.11.2015 10:05 schrieb "Michael Van Canneyt" : > > And I think you highly exaggerate the amount of time it takes for Mattias to enable new features in the IDE codetools. If he is aware of a new feature, it generally is added to the IDE very quickly. > > On the whole, I tend to see the current situation as a plus, rather than a minus. Plus there are no services of the compiler you could ask. The compiler is highly integrated and not even the textmode IDE - which has the compiler statically compiled - in can do this.

Exactly. That was the gist of my statement that

"The compiler structure is currently entirely unsuitable for this purpose."

Michael.

Reply by email

Sven Barth
to Michael Van Canneyt
"Michael Van Canneyt" wrote 10 lines
On Tue, 24 Nov 2015, Sven Barth wrote: > Am 24.11.2015 10:05 schrieb "Michael Van Canneyt" < : >> >> >> And I think you highly exaggerate the amount of time it takes for

Mattias

Show quoted text 18 lines
> > to enable new features in the IDE codetools. If he is aware of a new > feature, it generally is added to the IDE very quickly. >> >> >> On the whole, I tend to see the current situation as a plus, rather than > > a minus. > > Plus there are no services of the compiler you could ask. The compiler is > highly integrated and not even the textmode IDE - which has the compiler > statically compiled - in can do this. Exactly. That was the gist of my statement that "The compiler structure is currently entirely unsuitable for this

purpose."

It seems I have problems with communicating after a weekend of coding :P

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151124/37d8206b/attachment.html>

Reply by email

Mattias Gaertner
to Marco van de Voort
Show quoted text 7 lines
On Tue, Nov 24, 2015 at 12:09:25PM +0100, Sven Barth wrote: > > Plus there are no services of the compiler you could ask. The compiler is > highly integrated and not even the textmode IDE - which has the compiler > statically compiled - in can do this. And of course the result would be GPLed to start with it.

Is this a problem?

Mattias

Reply by email

Marco van de Voort
to Mattias Gaertner
Mattias Gaertner wrote 7 lines
> > Plus there are no services of the compiler you could ask. The compiler is > > highly integrated and not even the textmode IDE - which has the compiler > > statically compiled - in can do this. > > And of course the result would be GPLed to start with it. Is this a problem?

This depends on the nature of what you want to integrate with :-)

Reply by email