Do external (editor-independent) refactoring tools exist? - refactoring

Does a refactoring (able do conscious language-aware rename classes/variables renaming and replace simple constructions instead of doing dumb string search-and-replace) tool exist which can be used without IDE/editor?
I am particularly interested in Scala, C# and PHP languages.

For Scala there is a refactoring library that can be used standalone: http://scala-refactoring.org/

Not exactly what you are looking for, but Bicycle Repair Man, a Python refactoring tool, ships as an editor-agnostic refactoring library. It's actually used via editor/IDE plugins though.

Related

Is it possible to apply refactoring using OmniPascal?

I've installed OmniPascal extension in Visual Studio Code to use it for coding in Delphi and I am loving it. Code completion, parameters hint, go to declarations, all working 100%! Nonetheless, I am missing the refactor commands like rename (CTRL+SHIFT+E). Is that already implemented in OmniPascal?
There are currently no refactoring tools implemented in OmniPascal. Rename and Extract method are planned for the future but there are other features that need to be implemented before OmniPascal can turn into a reliable refactoring tool.
As long as OmniPascal doesn't handle all language features correctly (like with-blocks or class helpers) the rename command would produce wrong results. You don't want to work with such a refactoring tool.

Is there an equivalent to HLint for Erlang?

HLint is a Haskell lint tool for making code more idiomatic. Is there something like it for Erlang?
There is a tool called "Tidier": http://tidier.softlab.ntua.gr/mediawiki/index.php/Main_Page, which is based on a simpler module called erl_tidy which is part of the syntax_tools library: http://www.erlang.org/doc/man/erl_tidy.html.
Tidier is used via a web interface, letting you choose interactively which changes you want it to perform. It can do some amazing things, and is a great tool for learning how to write idiomatic Erlang.
Yes there is. Its called erl_lint
There's now also elvis. Although it is not specifically a linter, it does check that Erlang code conforms to certain rules which can be configured.

How Is Syntax Highlighting Built?

I'm now building a developers editor using Lazarus and as every good developers editor, it needs to have a syntax highlighting, because of this that I want to know some things:
How is syntax highlight normally built(using many ifs to change the font on a TextField?
TSynEdit is very nice to do this?
How to use TSynEdit(links and resources)?
You can actually see an excellent example for yourself if you look at the editor for SharpDevelop. It's implemented in C# but uses great OOP that should be readily portable to other platforms or languages.
Most home-brewed syntax highlighters tend to use the MS Windows RichText control but they're usually slow and clunky and really slow down when a lot of code is added.
You could read the source code of Eclipse or VIM. In Eclipse you will find an Abstract Syntax Tree base. On top of it are parsers that are carefully written to be tolerant of errors, since code in progress often does not satisfy the full grammar of the language. The highlighting uses the information in the syntax tree.

In Ruby, what's the equivalent of Java's technique of limiting access to source in a cowork situation?

In Java when you compile a .java file which defines a class, it creates a .class file. If you provide these class files to your coworkers then they cannot modify your source. You can also bundle all of these class files into a jar file to package it up more neatly and distribute it as a single library.
Does Ruby have any features like these when you want to share your functionality with your coworkers but you don't want them to be able to modify the source (unless they ask you for the actual .rb source file and tell you that they want to change it)?
I believe the feature you are looking for is called "trust" (and a source code control repository). Ruby isn't compiled in the same way that Java is, so no you can't do this.
I have to say your are in a rough position, not wanting to share code with a coworker. However, given that this is an unassailable constraint perhaps you could change the nature of the problem.
If you have a coworker that needs access to some service provided by a library of yours, perhaps you could expose it by providing a web/rest service instead of as a .rb file.
This way you can hide your code behind a web server, and if there is a network architecture that allows for low latency making these service calls, you can effectively achive the same goal.
Trust is a lot easier though.
edit:
Just saw this on HN: http://blog.astrails.com/2009/5/12/ruby-http-require, allows a ruby file to include another file through http instead of the filesystem.
Ruby is
A dynamic, interpreted, open source programming language with a focus on simplicity and productivity.
So like all interpreted languages, you need to give the source code to anyone who want's to execute your program/script.
By the way searching "compiled ruby" on google returned quiet a few results.
I don't think there is one. Ruby is purely an interpreted language, which means ruby interprets your source code directly in order to run it. Java is compiled, so there's an intermediate bytecode (the .class). You can obfuscate your ruby if you really wish, but it's probably more trouble than it's worth.
Just to make sure you realize, however, upwards of 95% of Java can be decompiled back into source using various free utilities, so in reality, Java's compilation isn't much better than distributing Ruby source.
This is not a language specific problem and one that can be managed more effectively through source control software.
There is a library called ruby2c that compiles a subset of Ruby into C code (which you can then compile into native code, if you want).
It was actually originally written as a Ruby code obfuscator (but has since been used for lots of other stuff, including Ruby Arduino development).

complex.h workaround in Visual Studio

After some searching I've found that Microsoft Visual Studio does not provide the "complex.h" header file, but I have some C code that unfortunately uses it. I've tried using <complex> and compiling as C++ code; this requires changing
complex
to
_complex
I don't even know what I would need to change
long complex
to. Any ideas how I can get around this?
Have you tried this link?
If you can't use third-party libraries, then I think you're going to be compelled to re-implement complex functionality yourself. The good news is that most complex math is actually really simple to write, unless you need some fairly advanced features.

Resources