Demo: Arguments after varargs, array-to-bool, C string ergonomics

Ойындар

...

Пікірлер: 39

  • @anonymousweeble2224
    @anonymousweeble22246 жыл бұрын

    Great work.. Seeing the SDL bindings made me really feel like I could start learning and using this pretty instantly, just by porting over an older project..

  • @linkVIII
    @linkVIII6 жыл бұрын

    Seeing abc work made me happy

  • @videouploader1677721
    @videouploader16777216 жыл бұрын

    I think a simple ergonomic feature is to allow decalring function parameters of the same type by listing them and only once specifing the paramters' type. Unless that would interact with other language features in some unexpected ways that I don't know. CreateWindowEx :: ( dwExStyle: u32, lpClassName: *u16, lpWindowName: *u16, dwStyle: u32, x: s32, y: s32, nWidth: s32, nHeight: s32, hWndParent: HWND, hMenu: HMENU, hInstance: HINSTANCE, lpParam: *void ) -> HWND #foreign user32; CreateWindowEx :: ( dwExStyle: u32, lpClassName, lpWindowName: *u16, dwStyle: u32, x, y, nWidth, nHeight: s32, hWndParent: HWND, hMenu: HMENU, hInstance: HINSTANCE, lpParam: *void ) -> HWND #foreign user32;

  • @blarghblargh

    @blarghblargh

    6 жыл бұрын

    like odin?

  • @videouploader1677721

    @videouploader1677721

    6 жыл бұрын

    Sure, also Pascal in ~1970.

  • @blarghblargh

    @blarghblargh

    6 жыл бұрын

    Yep. All the new fad language hotness is still just playing catch up with the 60s/70s

  • @sabamacx
    @sabamacx6 жыл бұрын

    Becoming even more pythonic. Great stuff!

  • @sssstupidkid1234

    @sssstupidkid1234

    6 жыл бұрын

    how?

  • @pleggli

    @pleggli

    6 жыл бұрын

    the arguments to a function can be defined like this where the args variable represent varargs (list) and kwargs represent variable keyword arguments (a map). Varargs can only exist after regular args and varkeywordargs can only exist after named keyword arguments. def func(arg1, arg2, *args, kwarg=True, kwarg2=True, **kwargs): pass

  • @pleggli

    @pleggli

    6 жыл бұрын

    In earlier python versions this function definition can be a bit troublesome readability/maintainability since it allows arguments to be called either as a unnamed or named argument: def func(arg1, arg2, kwarg=True, kwarg2=True): pass It is now possible to enforce that named arguments have to be used by just inserting a * before the kwd args: def func(arg1, arg2, *, kwarg=True, kwarg2=True): pass

  • @blenderpanzi
    @blenderpanzi6 жыл бұрын

    Can you say "if a && b { ..." where both are arrays?

  • @kazisiddiqui6435
    @kazisiddiqui64356 жыл бұрын

    The jai video KZread recommended to me the most (before I gave in and watched the whole playlist) is the second one. If other people haven't had different experiences, maybe you should link your playlist in the description of that video if you want fewer comments from people who haven't watched your demos.

  • @GegoXaren
    @GegoXaren6 жыл бұрын

    Have you had a look at ooc-lang, and if so, what do you think of it? It is really, really beautiful... (and has solved many of the problems you are discussing, and has excellent documentation)

  • @Peewma
    @Peewma4 ай бұрын

    I still come back to hear him say how stupid wide strings on windows are. Cathartic. Fuck utf16

  • @krux02
    @krux026 жыл бұрын

    you use memcmp to compare for unordered remove. This causes problems for alignment bytes in structs (at least in C/C++), and you get problems with floats (-0.0 ≠ +0.0, NaN).

  • @jblow888

    @jblow888

    6 жыл бұрын

    If you have one thing with -0 and another thing with +0, they are not equal. If you have two things with different alignment bytes for some reason, they are not equal.

  • @chriskruining
    @chriskruining6 жыл бұрын

    I was wondering, you said that after var-args the only way to break out of it is a named arg, not to disqualify named args, I would love to have them in PHP... but I remember that in the past I wrote some pattern matching for urls which had the same premises: viariables separated by a sepatator to match into parameters In my case I had 2 wildcards, a * which would match everything in one or more 'levels' and a + which would match all on the same 'level', a 'level' is whatever is in between two separators. in practice this would mean that a pattern of "page/*/+/show" matched to an url of "page/what/ever/will/I/show" will capture into an array: [ [ 'what', 'ever', 'will', ], 'I' ] to put this into the case of args the + wildcard would be ommitted but I imagine the * or this case the ..args would behave like a lazy regex capture. I mean when you already 'parse' passed arguments so why not pattern match them? the overhead would be very little I imagine. I'll try to give an 'example' with the concatenate case passed-args: [ 'hi', 'there', 'my', 'main', 'man', ', ', false ] pattern: '..args, string, bool' result-args: [ [ 'hi', 'there', 'my', 'main', 'man' ], ', ', false ] ============================================= as of writing this comment I see the problem with optional arguments after an ..arg, maybe this could be solved by indeed introducing some delimiter operator or maybe even thinking in regex terms introduce something on the defining side where it would limit the size for the ..args. For as far as I can see the only limiting factor is an optional argument after an ..arg of the same type, all other cases could be pattern matched, so in that case you would use an named arg. I would like to emphisize this is all food for thought and NOT a 'you should do this or if I were you I would have done that' thing

  • @chriskruining

    @chriskruining

    6 жыл бұрын

    btw, haven't seen the whole video, just before 25 mins

  • @chriskruining

    @chriskruining

    6 жыл бұрын

    whoops, this is all debunked in minutes 25-27, well nevermind than :P

  • @SETHthegodofchaos
    @SETHthegodofchaos6 жыл бұрын

    I am not sure if this has been talked about before, but any specific plans for code documentation?

  • @Chainelove
    @Chainelove6 жыл бұрын

    you have eluded to something quite powerful by saying that not everyone will want / be able to implement compile time checks, do you think it is possible for a "jai library" to contain compile time checks that you could choose to include into your compiler ?

  • @jblow888

    @jblow888

    6 жыл бұрын

    Yes, it's certainly possible. The question is how natural and easy we can make it to use that stuff.

  • @gettem6341
    @gettem63414 жыл бұрын

    In one of your talks, you said you didn't use a program like lex and yacc to parse, so what sort of algorithm are you using to parse the program? recursive descent, or shift reduce, or something else? and if you do a shift reduce parser, how did you create your tables if not with yacc?

  • @MaksimVolkau
    @MaksimVolkau6 жыл бұрын

    Can we have `concatenate :: (strings: ..string, between:="", prefix := "", suffix :="") -> string` ? Then you may specify `between` if you want glue ONLY between strings, `prefix` if you want some bullets or whatever before elements, and `suffix` for newlines, etc.. And you can mix and match all these together.

  • @hasen1957

    @hasen1957

    6 жыл бұрын

    No reason why you can't implement that yourself (once the language is released)

  • @blenderpanzi
    @blenderpanzi6 жыл бұрын

    Can you make join() use the temporary allocator without writing another tjoin() function?

  • @AldricBocquet

    @AldricBocquet

    6 жыл бұрын

    I think so, by pushing a new context with the temporary allocator as the default allocator before calling join.

  • @nikoerforderlich7108
    @nikoerforderlich71086 жыл бұрын

    It still isn't clear to me what exactly casting an array to bool means. So far seems that "if a do_it();" is shorthand for "if a.count do_it();" (which means "if a.count != 0 do_it();"). Is that all it does? It seems like a very small reduction to me. So much that I was suspicios of it when I first saw it and thought that it might check whether all items in the array evaluate to true.

  • @jblow888

    @jblow888

    6 жыл бұрын

    Yes, that is all it does. But the benefit is that you can have polymorphic code that doesn't know whether something is an array or a pointer or what, and it still works.

  • @nikoerforderlich7108

    @nikoerforderlich7108

    6 жыл бұрын

    Thanks for the explanation. I didn't think of that possibility. Now it makes sense.

  • @gettem6341
    @gettem63414 жыл бұрын

    Having #foreign SDL2 attached to each declaration looks a bit tedious, maybe have a processor tag that will say all of the following declarations are #foreign SDL2?

  • @smallduck1001001
    @smallduck10010016 жыл бұрын

    Question: can procedures be defined in the source file below where they're called? related: can sub-procedures within its parent also be defined below where they're called? I know that swift handles a function anywhere the top level in a file, but not anywhere within a parent func, and that inconsistency bugs me.

  • @benjaminpedersen9548

    @benjaminpedersen9548

    6 жыл бұрын

    Yes to the first question. I don't think he has decided on the second one yet. He would like it to be possible to define sub-procedures out of order, but he encountered some problems due to it at some point.

  • @videouploader1677721
    @videouploader16777216 жыл бұрын

    23:31 struct Vararg_Array { u8 count; u8 data_ptr; } size_of(Varar_Array) == 2; // 16 bits If the data pointer is 8 bit, does that mean that the maximum number of var-args is 32 = 256 / 8?

  • @Ruben_Peter

    @Ruben_Peter

    6 жыл бұрын

    I think he meant to say 8-byte count and data_pointer instead of 8-bit.

  • @Pyromuffin
    @Pyromuffin6 жыл бұрын

    can you add notes to a scope?

  • @TreesPlease42
    @TreesPlease426 жыл бұрын

    Could someone remind me what temporary storage is? I must have missed a video.

  • @VaustXIII

    @VaustXIII

    3 жыл бұрын

    Here it is kzread.info/dash/bejne/hYeKqrmriaqfZ5c.html&ab_channel=JonathanBlow

  • @aiman_yt
    @aiman_yt6 жыл бұрын

    Just a suggestion. Your videos are really long. It would be nice if you could summarize it to say, 10 mins and maybe put it at the end of the video.

Келесі