Demo: Self-browsing code, compiler message loop, workspaces.

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ต.ค. 2015
  • This one is a little rambly at the beginning, but hang in there because the functionality being demoed is very strong!
    If you would like to follow along, you can download the demo source here:
    dl.dropboxusercontent.com/u/2...

ความคิดเห็น • 77

  • @rafagd
    @rafagd 7 ปีที่แล้ว +34

    7:58 this must have been the most intense compilation of all time.

  • @mrsecify
    @mrsecify 8 ปีที่แล้ว +25

    This guy is wicked smart

  • @irina_divine
    @irina_divine 3 ปีที่แล้ว +2

    if compiling shit played music i wouldn't care about how long it took to compile, its keeping me entertained while i wait for my hard work to represent its self

  • @andrewkrieg538
    @andrewkrieg538 8 ปีที่แล้ว +54

    I think the final IDE should play music while compiling just so we can.

    • @gcewing
      @gcewing ปีที่แล้ว +1

      The mood of the music should reflect the way the compilation is going. If there are errors, you get horror movie music. If successful, you get a triumphant climax.

  • @JasonBock
    @JasonBock 7 ปีที่แล้ว +7

    I'm primarily a C# developer and it's great to see that the language now has a way to add analyzers to check for things that may be problematic in code. It's awesome to see this being built into JAI right away!

  • @MarkRushow
    @MarkRushow 8 ปีที่แล้ว +15

    My understanding of programming is extremely shallow (maybe ankle deep). However I like listening to these while playing The Witness; even though I probably don't understand 90% of it. I get general concepts of what he is trying to do and why; it is really interesting.

  • @Xavier-cd6fx
    @Xavier-cd6fx 6 ปีที่แล้ว +7

    It seems really great, I can imagine doing some build introspection tools easily and specific to our needs. A lot of tools are just hard to setup because they need to be mostly able to build the project, that it means we have to give them macros,... Here even a dead code detection tools seems feasible by simply doing a call-graph of all build scheme we have and do an analysis after to find functions that aren't linked to the main function,...
    I like very much that all of this is an enforced procedure because some checks are a part of the build that we can't skip instead of external tools that are runs manually or by a contiguous integration system.
    I found also very nice that you care about how code will live (refactoring, developer turn-over,...) with this programming language, because most language doesn't seems to care about that, but this is critical when a code a software will have to be maintained during years or decades, which is generally the case for C or C++ programs.
    Will you add some of those functions for the compile time analysis in the standard library?

    • @oblivion_2852
      @oblivion_2852 4 ปีที่แล้ว +2

      I find it interesting how much information is thrown away or lost at compile time which can't be accessed during compilation. Conventional macros are very clunky and I can really appreciate simple things like variable names and complex data types (user-declared types) to be accessible at compile time. For instance why can't I get a list of the names of the properties and functions within a given struct or class? Why can't I get a list of the types? Sure back in the day computers were memory limited and you couldn't save all that data while compiling but now we can...why don't we? Also it's infuriating to me that when I declare a enum in C++ I can't get the enums string representation at compile or runtime unless I explicitly store it.
      I'm not sure if Blow will add or should add options to remove the variable name and type data for the runtime executable (maybe options to remove property name by default and type is kept). The executable will always be tokenised so the only difference between keeping that data and removing it would be a few tables/dictionaries at the start. Does anyone happen to know what blow has decided for property and type data within the exe. Maybe there could be compiler options to only store name and type data within specific files (only storing things within the main program file instead of everywhere). Just some ideas I'd like to ask him.

  • @LizardanNet
    @LizardanNet 8 ปีที่แล้ว +2

    Simply amazing. Keep up the good work. You're such an inspiration.

  • @GabrielHasbun
    @GabrielHasbun 8 ปีที่แล้ว +6

    #OOP
    #JAI
    Fabulous. I really hope game programmers around the world adopt JAI so that we can finally end OOP's misery.

    • @nintendude794
      @nintendude794 2 ปีที่แล้ว +1

      “Oops, Jai, did it again…”

  • @oblivion_2852
    @oblivion_2852 4 ปีที่แล้ว +1

    Yay for mapping internal compiler code/structure to compile time evaluation code for future proofing (ish).

  • @bochen_art
    @bochen_art 8 ปีที่แล้ว +6

    Awesome stuff.
    This language should be called "Bananas", because it is going bananas with me all the time :D

  • @Plasticcaz
    @Plasticcaz 8 ปีที่แล้ว +1

    Woah at 8:00 ... that's amazing!

  • @SuperIdiotMan00
    @SuperIdiotMan00 6 ปีที่แล้ว +5

    I'm just glad it doesn't play "In the Hall of the Mountain King".

    • @nintendude794
      @nintendude794 2 ปีที่แล้ว +1

      I understood that reference.

  • @peterSobieraj
    @peterSobieraj ปีที่แล้ว

    I love backward compatibility.

  • @nERVEcenter117
    @nERVEcenter117 8 ปีที่แล้ว

    Reminds me of Clojure's Boot build tool. Insanely complex tasks contained in a function that can be run at compile time. Very cool!

  • @FalconGames109
    @FalconGames109 8 ปีที่แล้ว +1

    It would be interesting to try to implement a full-on macro syntax using tree modifications when those come along. How open will the API be for that -- will it be possible to, for example, define new keywords or new operators? What about just a custom #define directive?

  • @RawwestHide
    @RawwestHide 8 ปีที่แล้ว +1

    neat

  • @GingerGames
    @GingerGames 8 ปีที่แล้ว +9

    Workspaces are an amazing concept and the meta-programming abilities are unbelievable (more than before). The blur between the compiler and the program is extremely useful especially for custom warnings, errors, restrictions, etc. Having access to the AST is absolutely amazing.
    There is one problem with this that comes to mind, this could be a huge security flaw if something got into the code and ran at compile time, it could easily rewrite files and many other things. This is not really a problem as long as you only use code you trust and also, Lisp has been doing this for decades. (Also, I liked the meta-meta-programming outputting Scheme.)
    I have a few questions if you do not mind; I apologize in advance for the amount of them:
    * How do you prevent #run code from crashing the compiler? (Or this just the halting-problem?)
    * With explicit casting, Golang says no implicit casting but I do agree, float and int multiplication can be annoying but again as you have shown, this is just a simple thing to implement a flag.
    * Are owned/unique pointers implemented yet? Do they need to be explicitly freed? Any other move semantics implemented?
    * What types "need" to be `delete`d rather than `free`d? What types have (implicit) destructors? (Also a very minor thing, wouldn't `new` better as a procedure rather than an operator?)
    * What is the difference between #import and #load?
    * In C/C++ I use `const` as way to indicate how a procedure uses pointers e.g. const char* (to be read), char* (to be modified). I know I can always cast away the const but it's nice way to indicate. Do you think there would be a way to indicate this? E.g. everything is immutable when passed except when indicated not to be or do the windows api approach (e.g. _IN_, _OUT_).

    • @freiherrvonundzu
      @freiherrvonundzu 8 ปีที่แล้ว

      +Ginger Games If i'm not mistaken #import links to a lib (dll), #load on the other hand is simply including text into your file.

    • @GingerGames
      @GingerGames 8 ปีที่แล้ว

      Serge Ratke thank you. #load = include file, #import = import module

    • @freiherrvonundzu
      @freiherrvonundzu 8 ปีที่แล้ว

      +Ginger Games i probably got to correct myself. #import tells Jai to import a module (e. g. "Basic"), so jai does whatever it needs to load the module (in this case it includes (?) Basic.jai), in Basic.jai #foreign_library command tells Jai to link against a dll. Kinda like that?

    • @blenderpanzi
      @blenderpanzi 8 ปีที่แล้ว +2

      +Ginger Games "this could be a huge security flaw if something got into the code and ran at compile time"
      I first thought that too, but then I remembered build scripts already run arbitrary code. So it doesn't really opens any new flaws.

  • @999a0s
    @999a0s 5 ปีที่แล้ว

    bret victor is gonna GO_BANANAS when he comes across this video

  • @berkano_plays
    @berkano_plays 8 ปีที่แล้ว

    Would it be possible to have Attributes (kinda like C#), which would be available to the post-compiler steps, to designate whitelisted transgressions without hardcoding it outside of where they happen (aka separate file)?
    Have you looked at Roslyn and how one can build up the compiler/transpiler infrastructure?
    It seems like a lot of that infrastructure code might benefit from being open, with that in mind, are there plans for namespaces and some form of package management, like "go get" or rust crates?

  • @ryutenchi
    @ryutenchi 8 ปีที่แล้ว +1

    +Jonathan Blow you may want to try livecoding dot tv for streaming. It uses HTML5 video streaming and is geared directly towards programmers. (also, they could use more traffic)

  • @shavais33
    @shavais33 4 ปีที่แล้ว

    @20:39 - Do I understand correctly that setting the value of a variable at compile time generates code to make that variable start out with that value at run time? So these build time functions run at build time and collect information about the code builing built and alter things, and the code to affect those alterations is added into the compiled code? So to figure out what your post-pre-build code looks like, you have to sort through these compile time programs? Is that better or worse than sorting through Microsoft's Visual Studio .csproj files or Linux's autotools make files? It's slightly better than macros I suppose, since at least it's in the Jai language. Can you see the altered version of the code after the build time programs run? Is it output somewhere?
    Good grief, what if some library you included the source code for started modifying the post-build version of your program? I guess they wouldn't be able to do that, right? Because they don't have access to your code at build time. If they could, I think that could very easily end up being nightmarish.

  • @oblivion_2852
    @oblivion_2852 4 ปีที่แล้ว

    Say you want more implicit casts? Can you define more implicit casts or will the compiler always throw an error?

  • @Fangornmmc
    @Fangornmmc 8 ปีที่แล้ว +4

    Would it be advisable for someone who wants to use JAI as soon as it is available to start learning C++? I mainly program in C# and would like to prepare myself as best I can to get into JAI. To be honest, I don't really like C++ so if there's something else out there that resembles JAI and will help make the transition easier, that would be great. Does anyone have a suggestion? (I've found lisp being mentioned a couple of times...)

    • @jblow888
      @jblow888  8 ปีที่แล้ว +20

      +Fangornmmc lisp is not even remotely similar, but it can be a good language to learn if you want a counterpoint to the kinds of languages that came from C. As for languages that are similar, I don't know of any ... that is why I am making this one!

    • @Fangornmmc
      @Fangornmmc 8 ปีที่แล้ว +1

      +Jonathan Blow Thanks for the answer! I think I'll wait for JAI to release then. Unless you have any other suggestions as to what concepts I, or anyone else, could start reading about to help ease the transition?
      Sorry if that's a malformed question. I am not a very experienced programmer and I can't always tell if concepts you talk about are general concepts or JAI specific, hence why I am asking if there's any reading that I can do that will make it easier for me to understand JAI when it becomes available. Many thanks in advance!

    • @ihrbekommtmeinenrichtigennamen
      @ihrbekommtmeinenrichtigennamen 8 ปีที่แล้ว

      +Fangornmmc
      Wow, I feel exactly the same way. I mainly use .NET because it's fun, but I'd love to have an easy to understand low-level language which actually works. I have tried to compile C and I did not succeed. Not even my own code but a complete project I downloaded. It was impossible to tell the compiler to just compile the thing and give me an executable which I can run. And I guess that's exactly what Jonathan means when he talks about tools which don't work well.
      By the way: I have a very strong opinion about casing of identifiers. So far everything is done in snake_style (particularly compiler-specific methods like "add_build_path"). You said multiple times that you don't want to decide on syntactic things yet but you might have a strong opinion about that too.

    • @nERVEcenter117
      @nERVEcenter117 8 ปีที่แล้ว +2

      +Fangornmmc Closest I can think of is D, it has a lot of the sugary goodness Blow is baking into Jai, but there are some differences which Blow made clear back in 2014 when he started this (D has RAII, exceptions, and optional GC).

  • @jeanpauldupuis
    @jeanpauldupuis 5 ปีที่แล้ว +2

    please invoke stop_all_music

  • @Scy
    @Scy 8 ปีที่แล้ว +3

    Did your twitch channel get suspended? I tried to get in to see the VOD from yesterday, but it said you've been naughty.

    • @crimsun7186
      @crimsun7186 8 ปีที่แล้ว +6

      +Scy Apparently, he moved to Hitbox, like every sane serious live streamer.

    • @syoxsk
      @syoxsk 8 ปีที่แล้ว

      +Crimson Sunrise Whats his name there?

    • @syoxsk
      @syoxsk 8 ปีที่แล้ว

      +syoxsk Ok seems to be the same :)

    • @flora-webp
      @flora-webp 8 ปีที่แล้ว

      +syoxsk it's www.hitbox.tv/jblow for any other people who see this (took me a while to find).

    • @syoxsk
      @syoxsk 8 ปีที่แล้ว

      +Richman Stewart thx. thought it was naysayer88.

  • @nexovec
    @nexovec 3 ปีที่แล้ว

    So basically WinDirStat for source code :O wutw

  • @Moby41
    @Moby41 8 ปีที่แล้ว

    anyone else think about Nicolas Cage losing his shit when the music came on? LOLL

    • @nintendude794
      @nintendude794 2 ปีที่แล้ว

      Nick Cage was in Requiem For A Dream?

  • @AkamiChannel
    @AkamiChannel 4 ปีที่แล้ว

    You got banned from a streaming site? Which one?

  • @linkVIII
    @linkVIII 8 ปีที่แล้ว

    there was a ban from twitch?

  • @togmeister8604
    @togmeister8604 8 ปีที่แล้ว

    Does anybody know what text editor he is used. It's called emac@ION PC but I can't find anything on it.

    • @crimsun7186
      @crimsun7186 8 ปีที่แล้ว

      +Togmeister emacs running under cmder.

    • @togmeister8604
      @togmeister8604 8 ปีที่แล้ว

      Crimson Sunrise Ah, thanks.

  • @gettem6341
    @gettem6341 4 ปีที่แล้ว

    when you do #run invaders(), how do you run code before youve written the .exe for the game?

    • @needlessoptions
      @needlessoptions 4 ปีที่แล้ว +7

      There's a bytecode interpreter inside the compiler, so he compiles the invaders procedure into his own bytecode and then executes it. It's not native code.

  • @jimmyjimbo666
    @jimmyjimbo666 8 ปีที่แล้ว +2

    Hey Jon Blow. I think I found a bug in Mixer_Async.jai. On line 245, I'm pretty sure:
    for j : 0..handler.num_channels {
    Is supposed to be:
    for j : 0..handler.num_channels-1 {
    ???? Thanks for reading and thanks for the awesome demo :-D!

    • @GingerGames
      @GingerGames 8 ปีที่แล้ว +2

      +Jimmy Jimbo I am thinking this inclusive..inclusive is probably error prone and inclusive..exclusive is better e.g.
      for i : 0..N {}
      is better than
      for i : 0..N-1 {}.

    • @ihrbekommtmeinenrichtigennamen
      @ihrbekommtmeinenrichtigennamen 8 ปีที่แล้ว

      +Ginger Games
      I vote for an explicit keyword:
      for i : 0..N exclusive {}
      for i : 0..255 inclusive {}
      Now we just need to decide what the default is (if there is one).

    • @jimmyjimbo666
      @jimmyjimbo666 8 ปีที่แล้ว +1

      +Ihrbekommtmeinen Richtigennamennicht Don't love that to be honest. It would be annoying having to type the keyboard and if your going that route you might as well do it like a normal for loop.
      for i : 0 < N {}
      for i : 0

    • @nameguy101
      @nameguy101 8 ปีที่แล้ว +1

      +Jimmy Jimbo
      You are all wrong, Mr. Blow discussed this in his first jai demo. Both values are inclusive, and he finds syntax denoting otherwise ugly - just subtract 1.

    • @ihrbekommtmeinenrichtigennamen
      @ihrbekommtmeinenrichtigennamen 8 ปีที่แล้ว

      Nameguy
      Ah, the beauty of a language which doesn't restrict itself to short syntax. * cough * Basic
      :P

  • @iroxudont
    @iroxudont 8 ปีที่แล้ว

    Have you put the source code for the toolchain out there yet?

    • @iroxudont
      @iroxudont 8 ปีที่แล้ว

      Timothy Schmid
      So its proprietary? Whats the end-game for this project? He aims to have it as a wide-spread tool in any shape or form?

  • @DreadKyller
    @DreadKyller 8 ปีที่แล้ว +1

    What did you do on Twitch to get banned?

    • @jimmyjimbo666
      @jimmyjimbo666 8 ปีที่แล้ว

      +DreadKyller He was playing a video of Putney Swope during the prestream. Like, straight from youtube I'm pretty sure :-(.

    • @PhilShary
      @PhilShary 8 ปีที่แล้ว

      +Jimmy Jimbo The situation is quite ironic, considering the questions raised in that film. :)

  • @kristoffersemelka2660
    @kristoffersemelka2660 8 ปีที่แล้ว

    This just sounds like Rust's custom lint plugins.

    • @jblow888
      @jblow888  8 ปีที่แล้ว +1

      +Kris Semelka (a) There are some pretty major differences between the way Rust does checking and the way this language does; if you are not sensitive to these, you are maybe not part of the audience for this language. (b) Not many languages have features in this category at all, so if you say "just sounds like blah blah blah thing from Rust that didn't even exist a couple of years ago" you are just being a troll. (c) Watch the next video in the series if you want to see where this goes in a way that is drastically different from where Rust goes.

    • @kristoffersemelka2660
      @kristoffersemelka2660 8 ปีที่แล้ว +3

      +Jonathan Blow Sorry, this was not a troll post, just a case of sloppy commenting. I meant the above in regard to the custom MISRA checks. Such a usage of compile time evaluation and hooking into the compilation process simply reminded me of the rust lint plugin architecture which is used in exactly the same manner (compile-time executed code operates on a structural representation of the program) as you show here. That is meant to be a positive comparison, not a diminutive comment. I understand, of course, that there are vast differences with the approaches the two languages make and that in general Jai's compile-time evaluation has much broader applications.
      I think you might have thought that I was saying your thread-safety checks were just an imitation of Rust's thread-safety checking. I was not. I realize you are fine-tuned at this point to deflect the peanut gallery and all its superficialities but peanuts I bring not.
      I will gladly watch the next video in this series. :) I have been a fan of this video series since you announced the language, and am catching up on recent additions.

    • @nintendude794
      @nintendude794 2 ปีที่แล้ว

      @@kristoffersemelka2660 nice :)

  • @AkamiChannel
    @AkamiChannel 4 ปีที่แล้ว +1

    Ah, you may be getting banned bc you are playing copyrighted music. That would make sense.

  • @BerciTVV
    @BerciTVV 8 ปีที่แล้ว

    what is the song?

    • @Ruben_Peter
      @Ruben_Peter 7 ปีที่แล้ว +4

      Requiem For a Dream -Lux Aeterna

    • @nintendude794
      @nintendude794 2 ปีที่แล้ว

      by Clint Mansell!

  • @tomimak
    @tomimak 8 ปีที่แล้ว

    The compiler "jai" is available for download ???

    • @jimmyjimbo666
      @jimmyjimbo666 8 ปีที่แล้ว +3

      +tomimak The compiler is not available yet but it will be eventually. In the meantime you can download the JAI samples for this demo if you are curious. See: twitter.com/Jonathan_Blow/status/654393674877407232