Using the Free Pascal IDE for a Week
cypherphunk.blogspot.com
cypherphunk.blogspot.com
I think you just answered your own question. It's there because it's functional and works on most if not all of the supported developer desktops. Of course, it won't win any beauty contest but I suspect most of those using it probably won't either.
What I'd like to see are TUIs that embrace terminals running on large, high-resolution displays. We don't need to be constrained to 80 columns by 25 rows, or whatever.
80x25 grids with monospaced characters are pretty arbitrary of course. But you can use grids on top of other systems, it just gets more fiddly.
What does this mean. Does "those" refer to (a) "developer dektops" or (b) the people using them.
Press Ctrl+F1 on any function name, and you are instantly taken to a very good help page, often with a working code snippet example!!!
I can't overstate how insanely great it was, especially in pre-stackoverflow days!
site:stackoverflow.com
for instance WriteLn site:stackoverflow.com
So it would open up the top result of Google's SERP, i.e.https://stackoverflow.com/questions/617654/how-does-writeln-...
mark_begin // after allocs,creates
[parse1, sl1, sl2]
mark_end
... lines of code ...
release // end of proc, frees everything you marked allocated
I thought it would be a good prank as a form of revenge, but he kept getting angrier and angrier and eventually I was too afraid to confess. The teacher had wandered over and was getting exasperated too. I think eventually they assumed he had a corrupted network drive and just nuked his entire network account and set up a new one with a new username, and now suddenly his compiler "worked" again. Heh.
I think a lot of modern coders really forget how much you used to need to know. Even stuff like "jump to definition" wasn't a thing IIRC back then.
Also came through that era, I don't miss it, modern tools are abstractions for the brain (and a logical progression from what we had before).
Everything is so much bigger and more complex than it was (mostly because things are bolted together from a large number of libraries from different places with their own subtle or not so subtle conventions).
In days of you had the languages standard libraries and libraries you wrote yourself and very rarely some Hallowed Third Party Library that was handed down on stone tablets by the Prophets of the Finance Department.
Some stuff I miss, most I don't.
Pascal/Delphi is actually almost a perfect language to write a smart editor around: the grammar is highly regular and requires minimal lookahead to parse, and definitions always precede usage.
Next 3 companies I worked for were using Delphi 5, despite Delphi 6, 7 and 8 existing by that point. Same reason - if it isn't broken, you don't need to jump to the next best thing.
Also worth noting - the company I directly worked for after the one above was a Borland partner in the UK and Borland outsourced training and consultancy to them (I was under Borland NDA) and we therefore had access to pretty much all the Borland software (I have a copy of the first Kylix Beta somewhere still I think)
I wish the teacher had made us jump into C++ directly.
You should try Delphi nowadays, it has plenty of modern languages concepts implemented. Not to mention the compiler speed and the cross platform capability for all OS'es that matter.
And yes, Delphi has a small but loyal following. But personally, I feel more comfortable relying to standardized languages (preferred: ISO) and among those a pick with easily recruitable talent. So I wouldn't recommend a new production development in Delphi myself.
Still only a hobbyist.
I remember that when I was developing with compiled languages ages ago (C and Java) I had an emacs configuration to compile and debug from within the editor. Eventually I gaved up emacs when writing Java and switched to Netbeans and Eclipse. Then I switched to interpreted languages (Ruby, Node, Python) and I'm using emacs again. Plain modes for those languages, no autocompleters except a very basic language indipendent one and it works like a charm. It also works like that with Elixir and Phoenix, which autocompiles itself. It's been probably 10 years since I installed an IDE on one of my computers.
Doing Java programming in, say, Emacs would be fine if it weren't for import hell.
I don't know if recursive star imports are possible, though (e.g. jakarta.** or jakarta.*.*).
> It used to be possible to run a terminal session 'attached' to Lazarus, so that it could be debugged from the IDE, but since a previous update this always seems to fail on my PC.
There could be some lingering settings. In my Lazarus build (from git, so it has the latest and greatest features and bugs) it is possible to run a program using a separate "launcher" from Run -> Run Parameters -> Check the "Use launching application" and then type something like "xterm -e some command that runs your app". In fact in my PC it pre-fills "/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"
This should allow for debugging terminal programs from Lazarus.
> I'm not sure what the rationale is for maintaining the text mode FP IDE. It seems kinda quaint in 2022 to maintain a recreation of the old Turbo Pascal editor.
It provides a basic IDE wherever Free Pascal is available. Note that, e.g., Free Pascal runs on DOS, OS/2, AmigaOS, etc and the IDE works in those environments too (DOS support is also why the IDE "embeds" the compiler instead of calling out fpc.exe).
It also works as a showpiece for Free Vision (also part of Free Pascal) which provides a TUI framework. Sadly, as it is based on the original Turbo Vision, it uses the old "object"-based types instead of "class"-based types, so it misses a lot of useful functionality for programming - but from a user's perspective it is IMO a perfectly fine TUI.
> I'm not sure why this is the default setup, but you need to tell the IDE where to find the Free Pascal files on your system.
This might be some installation problem, on a fresh install FP should be able to work out of the box. Perhaps some distro issue? Try to use the generic tar-based installer from the Free Pascal site and install it system-wide.
> One of the main differences in the interface, compared to Lazarus, is that instead of a tabbed interface it has a series of windows. With the right font size, I actually prefer this interface as it means that I can see several related files on screen at once.
Note that you can have multiple source windows with Lazarus too, right click on any tab and select "Clone in new window" and it will create a new source window you can have side by side with other windows (sadly you can't use Alt+number to switch between them though - but your window manager might be able to do that for you). This way you can have both tabbed and floating windows if you want.
> The biggest thing that I'm missing so far is a good auto complete. The IDE will offer suggestions for completing Pascal keywords but, unlike Lazarus, it won't try to autocomplete your own variables or procedure names.
And auto-completing function/procedure definitions, etc in interfaces section to the implementation section, and symbol renames, and a quick jumps to declarations or between the interface and implementation section for a function/procedure, and a bunch of other stuff :-P. It'd be neat if those were added at some point though.
But i'm not sure how many people really work on the IDE nowadays, IIRC it used to be an external project that was merged with Free Pascal early in Free Pascal's history. I think nowadays even main FPC developers use Lazarus instead (note that despite being joined at the hip, Free Pascal and Lazarus are technically two different projects with each having its own development team).
But having said that and regardless of the limitations, i wrote a very large part of Post Apocalyptic Petra[0]'s code in Free Pascal and the game can be compiled and debugged from the IDE just fine. I did eventually switch to using Lazarus when i started working on the editor though (since i needed the GUI bits) and the standalone "Petra Engine"[1] (which contains only the engine part of the game, slightly modified) is really meant to be used with Lazarus for development (you can build the standalone example game with just FPC though).
So how did the test week go? (Just curious; I couldn't find an update...)
But I don't do things like jumping to declarations with it. That's likely a thing with some plugin, I just don't know. I generally try to avoid traditional OO languages when I can. I used to use IntelliJ for those, but I have actually switched to VSCode for them and some of the things I've always used vim/neovim for, like larger Go projects.
I make any IDE act like vim because my hands want to do modal editing. That's a thing where my habits impact my perceived ergonomics. If it doesn't support that, I won't use it. It's just too frustrating.
I don't use Javascript except when I have to. If that's part of a TUI VSCode for you, then this may not be helpful.
Nothing could be further from the truth. There are tons of plugins, scripts, tutorials for literally every scenario you can imagine since Vim has (never mind its predecessor Vi) has been around since 1991.
at some point you just can't do everything with single letters, you need actual, complex commands
Vim’s power is its composability. Once you understand text objects (word, sentences, paragraphs) and motions, you can do anything you want.
If you need to repeat a string of commands together, you can record macros on the fly, create an autocommand or a plugin if that’s what needed.
Neovim in particular has LSP support built-in, which gives the editor semantic knowledge of your code, just like an IDE. So renaming, refactoring, formatting, syntax highlighting work better.
There’s even a LSP server for Free Pascal:https://github.com/neovim/nvim-lspconfig/blob/master/doc/ser....
Or, no, you don’t need to use a graphical IDE to develop code, as TFA states.
Thank you for coming to my Ted talk.
EDIT: Don't believe me that VIM is an IDE? Read the threads for elucidation. :)
If "by default", you mean "with the default vim configuration", then this assertion is wrong.
Vim does have a definition-search" feature, but it needs hand-made configuration for each language, and since it relies on regexp instead of parsing the language, it's useless outside of micro projects.
To enable real code completion and navigation, vim needs plugins and external tools. The modern way is to use one of the LSP implementations for vim (I've tried ALE and CoC), but that's clearly not "out of the box" for vim.
Code completion, syntax highlighting, goto definition, goto tags... these are all core functions of VIM. Addons just help it work with languages other than C.
That’s cool, but if you already use Neovim for other things, there’s a Free Pascal Language Server Protocol (LSP) server for it too [1]. You’ll many of the same features that Lazarus has, like code completion, diagnostics, etc. In fact, it’s the same LSP that’s available for VS Code [2] and it uses Lazarus as a backend.
Too much is being made about how hard Neovim is to configure; if you’re new to it or to Lua, just use LSP Zero [3] that takes care of all of the details of installing LSP, linters, etc.
[1]: https://github.com/neovim/nvim-lspconfig/blob/master/doc/ser...
Sorry. Yes, (n)vi(m) is great and useful and all, but it’s not an IDE.
E492: Not an editor command: gd
VIM 8.2
Do I have to activate it somehow? :)
int foo ()
{
return 3;
}
int bar()
{
return foo();
}
put your cursor somewhere on the "foo" identifier in the second to last line and type "gD" (without the quotes). It should jump to the definition of foo. It's not perfect but works for much code without crazy preprocessor stuff. By default it's file-local, but you can give vim a list of include files to search as well.Specifically it's one of the 'g' commands (like gg which goes to the top of the file and gG goes to the bottom). Just put your cursor on an identifier and gD (goto definition is the mnenomic).
:help g
C doesn't have a defined directory structure, and a lot of the source/header files you'd use are stored in places like /usr/lib and such.
Vim works perfectly fine with multiple files out of the box, it just wants a tag file for jumping between multiple files and letting autocomplete work with those tags.
This is hardly unique to vim (and emacs) - you can't work on a project in IntelliJ without first setting up a workspace and letting IntelliJ index all those files. The only difference is how the index is generated.
Oh, and `:help cscope` (again, thanks aidenn0). In vim >=9.0 a tagging tool is now incorporated into the base vim install.
ctags was just the first example of many things I can refer to.
For example any basic C IDE on a default install is expected to have debugging integration, project management, among other stuff.
Granted I don't think vim is an IDE, but you'd demonstrate that better by pointing to the IDE stuff it doesn't do (like debugging, I think, but I debug with printf and only rarely fire up gdb so for all I know it does support it).
> Vim defaults to being a C IDE, no plugins required
And you can get Neovim with all batteries included: https://github.com/rockerBOO/awesome-neovim#preconfigured-co...