Hidden code

Is it as easy and seamless as in languages like C? Does it have drawbacks? Can it be done with the package provided by chakravala? Do I understand right that Julia can potentially be an almost full substitute to C, C++, C#?

@rohqhq Your question is abut whether or not Julia is a compiled language. Others have given some good answers. So if I may would it be OK to say something else?
For learning, you might be interested that we can actually see what code Julia is creating by using the macros called @code_llvm and @code_native

@code_llvm prints the llvm compiler bitcodes which Julia generates, for example

julia> f(x)=x^2
f (generic function with 1 method)

julia> @code_llvm f(2)
; Function f
; Location: REPL[1]:1
; Function Attrs: uwtable
define i64 @julia_f_35333(i64) #0 {
top:
; Function literal_pow; {
; Location: intfuncs.jl:243
; Function *; {
; Location: int.jl:54
  %1 = mul i64 %0, %0
;}}
  ret i64 %1
}
2 Likes

@rohqhq the macro @code_native prints the assembly language statements which Julia produces for your architecture. So if you are into seeing what exactly is being emitted by the Julia compiler and is being run then you can.
This is actually done by many, many people who want to get the highest performance form a code.

julia> f(x)=x^2
f (generic function with 1 method)

julia> @code_native f(2)
        .text
; Function f {
; Location: REPL[1]:1
        pushq   %rbp
        movq    %rsp, %rbp
; Function literal_pow; {
; Location: intfuncs.jl:243
; Function *; {
; Location: int.jl:54
        imulq   %rcx, %rcx
;}}
        movq    %rcx, %rax
        popq    %rbp
        retq
        nopl    (%rax)
;}
2 Likes

No, it is work in progress, since (in constrast to C) it is an extra feature, not something one would use in a normal workflow.

Possibly yes, but if you need to deliver applications and want to protect intellectual property by not providing source code (whatever that is worth), Julia is not (yet) the ideal solution.

Since you said you just started programming, I wonder if this is relevant though. Personally, I would not worry about it and just learn Julia.

3 Likes

The questions asked by rohqhq are indeed those that I would ask when preparing a business where Julia is used. I would actually only do this as someone who has major experience with Julia. In principle I would say that everything can be achieved but especially baking things into the system image requires some manual tweaking here and there. Just as an instance https://github.com/JuliaLang/PackageCompiler.jl is currently not working at all on Julia 1.0 since one has to install manually all dependencies into the global environment.

1 Like

@rohqhq Please listen to @Tamas_Papp Learn Julia and have some fun. There is a great community here.

Also if you can, tell us why you are enquiring about not making the code available. I am not being hostile to you - I should explain that there have been discussions on this board on similar topics in the past.
We need contributions from people like you.

Sure. I read a little bit about Julia and (maybe I’m wrong but) from my point of view the language has the potential to become the universal language, i.e. we can use Julia instead of Python, C, R, etc. It’s clear for me that Julia can be a full substitute for Python, R, etc. but I don’t know whether it can be a full substitute for languages like C. It would be great if yes. To be a full substitute for languages like C, Julia has to have the feature to hide the code. It’s necessary for many software projects not only because of protection of intellectual property (it’s important too) but also because open code means high exposure to hackers (correct me, if no). Although I’m going to use Julia for econometrics now, in the future I’m going to write software, so I want to know whether it’s suitable for it.
UPD: Software isn’t a right word. I want to break into robotics. I’m not sure whether the word “software” is applicable to robotics. But I’m still interested whether Julia can be used in software because I didn’t find this domain in the domain section.

This is absolutely wrong. Security through obscurity - Wikipedia

6 Likes

@rohqhq I was going to reply to agree with @tobias.knopp
Have a look at Linus’Law: “Given enough eyeballs all bugs are shallow” Linus's law - Wikipedia

Indeed, think about closed source software. There could be bugs in a package which have been in existence for years. Or bugs recently introduced. From personal experience, I have had to look at Linux kernel code line by line on many occasions. I am not a kernel contributor, but the skill of beign able to understand kernel code has been good for me.
Specific instances include an Ethernet network card which worked fine under tests - but when connected to a Cisco switch stopped working (this was a bug related to forward error congestion packets).
It was even there in the code - a comment along the lines of “Watch it - this will stop working after a bit with a Cisco switch if FEC is enabled”.
Another instance was tracking down the behaviour of the OOM killer on a large SGI NUMA machine, which pulled the machine down. Being able to pinpoint what the OOM killer was doing was invaluable.
With a commercial Unix I would not have had any hope of doing anything like this.

Being constructive, we are seeing more and more software being developed with open source but commercial support available.
The software is open sourced, and perhaps released on a GitHub repository. There will be some good forums or email lists created. However should you need commercial support then a support contract can be purchased.
One example is the PBSPro batch system from Altair. Academic sites in the past would tent to implement the free of charge OpenPBS, which was a rather old fork of PBS. commercial sites would implement the paid-for PBSPro. Altair were very enlightened and realised that market share is important to them, and having open source developers and bug finders from both the academic and commercial worlds is important.
SO PBSPro is now dual licensed - you can download the source - as I have done. Or you can get a support contract, which means that if your companies $$$$ HPC system goes down you have someone to ring up.

4 Likes

The information about open source and exposure to hacking is interesting. Thank you for breaking down this misconception.
I still have several questions and I would be grateful if someone answers.

  1. Is Julia suitable for creating software now and potentially? I didn’t find this section in the domain section of this forum. And if it can be used for it, can Julia potentially compete with languages like C? Does it have drawbacks (that don’t relate with immaturity) that make it worse than languages like C in this domain?
  2. I’m still curious about closed code. Now I understand that one can potentially do it. But is the structure of code worse than in languages like C for it? I mean Julia may have some drawbacks that make creating closed code program less efficient than in languages like C, and it’s not because of immaturity, but because of the limits of the language.

Basically, my main question is can Julia be a full substitute for Python, C, etc. So these questions I ask to know the answer. If I miss some important issues related to this question, let me know. You’ve already answered some of my questions (thank you for that) but it’s still not clear for me what limits Julia has at this moment and what limits Julia has in the long-run period. I want to distinguish these limits in my mind.

Julia is a modern and performant language, and can replace Python and C in many, but not all contexts. Eg I would be surprised to see a Linux kernel written in Julia.

You are asking very abstract and mostly irrelevant questions about Julia, probably because you have not used it (enough) and may not have a lot of experience with programming (yet). This is common with people in a similar situation; users without much experience frequently believe that one can (and should) “evaluate” the language before investing in it.

I would suggest that your time may be better spent on just learning Julia, possibly by implementing a project you care about. Something related to scientific/numerical/statistical would be the best match for the language at this point.

2 Likes

This isn’t quite an answer to the question you asked but I think it may ultimately be the goal (IIUC) of your questions: I think Julia is one of a number of good options of a language to learn as someone new to programming. It does have some drawbacks for a new programmer — the tooling support is relatively immature, but that is changing quickly I think — but I believe the merits of the language outweigh those small disadvantages.

I doubt it is going to “take over” the other languages you mention, because language choice depends on not just the merits of the language, but the general inertia present in communities of people using those languages, and the overall ecosystem of support and packages available. If you want to have the most directly useful skills that will make it possible to get into a particular industry you should figure out what language that community already uses and learn that. But it is probably better to know multiple languages: learning programming languages becomes easier and easier the more you learn, and you will be most valuable to employers if you understand coding well enough to be facile in multiple languages. Learning a well principled language, which I think Julia is, is a good place to start.

2 Likes

Learning Julia will also spoil programming in less powerful languages (many of which are used widely) forever. It is like having a multitool which has a lightsaber as one of its tools.

4 Likes

Julia is ideal for robotics at least.

https://juliacomputing.com/case-studies/mit-robotics.html

See also: http://www.juliarobotics.org/

There’s also a video on this project in the offical Julia youtube channel, and I lrearn from it, that the project is done in pure Julia except for at least one C (communications) library (and no C++ library), i.e. all the “robotics” in Julia. From memory, they could have replaced it too, it just happened to be available. Julia’s standard math library is in part in C (C’s libm), and part of that was rewritten for up to 30% speed increase.

Note despite Julia having garbage collection (GC), it was still the ideal language, as you could avoid it. In some cases, e.g. the Linux kernel or other software already written in C (or C++), you may not want to extend with a different language, even if you could (e.g. with Zig language, or Rust). I’m not saying you couldn’t with Julia, extend or replace other projects (e.g. written in C or C++, because you can), at least it’s possible if you have C (or C++) code, to reuse from Julia using the ccall keyword, and that code, as it’s already compiled would be “hidden”, be obscure to read as it’s only in binary machine code.

If that’s your goal, then you may not need for all of the code used in your project to be “hidden”.

@Tamas_Papp OK, I’ll try to be less abstract. I’ve just opened another topic about a chess game. I decided to create another topic for the question because it does not fully belong to this one.
I have experience with Python for Data Analysis and I understand that Julia can be a full substitute for Python but I have no experience with creating programs so I ask questions above.
To be less abstract, I can try to clarify what I want to know. For example, Python is slow, so it can’t be used for big computation (if we don’t include Python libraries that are written in C++, etc). Also, Python cannot be used to create programs like games with an interface as I know (correct me, if no). Also one can’t use python to create software with closed code. And C++ has some problems such as difficulties with dependencies, difficult code, etc. They are all limits. I want to know Julia’s limits.
Also, I’m sorry that I’m asking almost the same questions several times. It certainly looks dumb, but I don’t receive enough information (although thank you all, now I understand more), so I try to rephrase questions to get the answers.
@Palli Yes, I know that Julia is good for robotics. It’s the main reason why I’m here.

It’s certainly possible to create a chess game in Python, like here. It’s possible to in most languages, although of course you can’t do it without using libraries that use C/C++ to interface with graphics hardware. In general though, creating a graphical application like this is not a very simple task, and in Julia it will be more difficult because there are not many libraries to do it yet.

I am not sure about this, if you can use Numpy/Scipy. The problem with Python in practice is not that it is hard to make it run fast, but that it is hard to make it fast and generic.

Note that developing games (or anything with an interactive UI) is not Julia’s comparative advantage at the moment. I know little about Python packages, but I would hazard that they are more mature for this purpose.

There are very few inherent limitations, but doing some things may require a lot of work on your part.

It is inherently difficult to ask the right questions without putting some work in first. As I suggested above, you can’t just make an a priori comparison for languages, ticking off some list. You can of course keep asking similar questions here, but this strategy runs into diminishing returns quickly.

1 Like

I’m not an expert in type systems, but a colleague of mine recently introduced me to dependent types and having the compiler prove useful properties about ones code using them (such as proving the correctness of e.g. leftpad). I’m not sure to what extent this is possible or not possible in Julia, but this may be one of the limits OP was thinking of (albeit dependent type systems don’t seem that easy to use in practice for user facing applications).

@rohqhq I guess the “right” question from our point of view would be “what sort of limit are you looking for?”, since there’s no real hard limit of possible vs. impossible from my point of view, only a spectrum from “piece of cake” to “requires an impractical investment of time”.

1 Like

Pretty much anything is possible with julia. The only reason anything becomes easy to do in any language is because some person put in a lot of hard work towards making that feature run well and also be accessible. In Julia, many things are easy to do because there is a devoted group of developers who spend their time making their dreams come true in their favorite programming language. The point is, they pick a problem they want to solve and create and abstract environment to facilitate the solution and make it easy to share. So if you are picking a programming language to contribute with, make the choice based on the problem to solve. The best way is to just try out writing some programs to see if the language helps solve your problem.

Is there an example of this somewhere? I have a project I’d like to share for testing purposes, but I do not want the source code exposed to the user.